Skip to content

Latest commit

 

History

History
86 lines (64 loc) · 2.18 KB

README.MD

File metadata and controls

86 lines (64 loc) · 2.18 KB

gensshconfig

Generate a config file based on Ansible inventories

Getting Started

Intallation

curl -ssf -L https://raw.githubusercontent.com/ca-gip/gensshconfig/master/install.sh | bash

(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 ~/Projects/ansible-kube/inventories/os

Alternatively save it

gensshconfig --user $USER_BASTION --bastion $IP_BASTION --inventory ~/Projects/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