This project is to allow automating the configuration of a Rancher Server through a configuration yaml file. It is designed so that a configuration file could be generated by a configuration management system, and then have rbs
wire up the servers configuration.
In this first version it can support configuring Rancher:
- Authenticate to Active Directory
- Add Accounts. (should only be used for Admin type accounts)
- Add/Remove environments
- Add/Remove Registries (with credentials)
- Create registration command for an environment.
See the config.yml.example file to see how the majority of types are created. The supported types are shown in the example.
Configure the Rancher server URL in your config.yml
---
server:
url: "http://rancherserver/v1"
...
To configure the command is then called as follows
NAME:
Rancher Bootstrap - File driven Rancher configuration
USAGE:
main [global options] command [command options] [arguments...]
VERSION:
0.0.0
COMMANDS:
registration-command, rc Get the registration command for nodes
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
-c, --config-file "./config.yml" Path to config file
-k, --key-file "./keys" Path where Admin Keys will be stored
--help, -h show help
--version, -v print the version
To get registration commands for Rancher environemnts the command can be run:
rbs-sandbox [-c <config.yml> -k <keys> ] rc <env>
this will output something like
sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v0.9.2 http://192.168.99.100/v1/scripts/DD2436B1788BB352D77B:1457067600000:ICYwLgay8H3xjbwVgPExtu62uVk
After the first run a pair of Admin API keys will be stored in the key-file. You will want to keep these credentials in a safe spot. If you delete these keys, you will need to log in with an Admin account to create new keys and place into the file.
Project level API keys are created and deleted as needed.