gensshconfig

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 7 Imported by: 0

README

gen-ssh-config

Generate a config file based on Ansible inventories

Getting Started

Intallation
curl -ssf -L https://raw.githubusercontent.com/ca-gip/gensshconfig/master/install.sh | sudo sh
(Alternative) Build the binary

You will need go v1.15

go build -o gensshconfig main.go

Usage

Ansible Inventory Layout

Generation works for project that use the following inventory layout

inventories
├── common_vars
│   ├── all.yml
│   └── all_vault.yml
└── os
    ├── client_one_hp
    │   ├── group_vars
    │   └── hosts.ini
    ├── client_one_prd
    │   ├── group_vars
    │   └── hosts.ini
    ├── client_three_hp
    │   ├── group_vars
    │   └── hosts.ini
    ├── client_three_prd
    │   ├── group_vars
    │   └── hosts.ini
    ├── client_two_hp
    │   ├── group_vars
    │   └── hosts.ini
    └── client_two_prd
        ├── group_vars
        └── hosts.ini
Example
You can check what the config will look like with
gensshconfig --user $USER_BASTION --bastion $IP_BASTION --inventory ~/Project/ansible-kube/inventories/os
Alternatively save it
gensshconfig --user $USER_BASTION --bastion $IP_BASTION --inventory ~/Project/ansible-kube/inventories/os > ~/.ssh/k8s_config

If you do not want to overwrite the default config like in the above exmaple, do not forget to include the following line in your main config file

Include k8s_config
Help

To see the available parameters

gensshconfig -h
Available options
Name Description Mandatory Type
bastion IP Address of the bastion yes String
inventory Inventory folder to extract clusters host yes String
user User for the bastion yes String

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL