Cloud-Init Integration

Commissaire provides a commctl command to generate a user-data file for cloud-init that automatically registers hosts to the Commissaire server during bootup. This command is aptly named user-data.

commctl user-data command

usage: commctl user-data [-h] -e ENDPOINT [-c CLUSTER] [-u USERNAME]
                                  [-p] [-r REMOTE_USER] [-s SSH_KEY_PATH]
                                  [-a AUTHORIZED_KEYS_PATH] [-C CLOUD_INIT]
                                  [-o OUTFILE]

optional arguments:
  -h, --help            show this help message and exit
  -e ENDPOINT, --endpoint ENDPOINT
                        Commissaire endpoint to use during bootstrapping
  -c CLUSTER, --cluster CLUSTER
                        Name of the cluster for new hosts to join
  -u USERNAME, --username USERNAME
                        Commissaire user to use when bootstrapping
  -p, --password        Prompts for a Commissaire password to use when
  -r REMOTE_USER, --remote-user REMOTE_USER
                        Remote user to provide to Commissaire for ssh access
  -s SSH_KEY_PATH, --ssh-key-path SSH_KEY_PATH
                        Path to the private key of the remote user
                        Path to the authorized_keys file of the remote user
  -C CLOUD_INIT, --cloud-init CLOUD_INIT
                        cloud-init.txt file to use
  -o OUTFILE, --outfile OUTFILE
                        Output file. If omitted STDOUT is used

Example: commctl user-data -p -c my_cluster -o cluster.userdata

Create the User-Data File

Let’s say you have the following properties:

  • A Commissaire username of USER
  • A Commissaire password of PASS
  • A Commisaire cluster you want new hosts to join called CLUSTER
  • A Commissaire REST Server listening at
  • The expectation of having the user-data file at ./CLUSTER.userdata

You would create the user-data file like so:

$ commctl user-data \
  --password \
  --username USER \
  --cluster CLUSTER \
  --endpoint \
  --outfile CLUSTER.userdata
Password: <PASS>
$ # Let's check that the userdata file is indeed a multipart/mixed file
$ file CLUSTER.userdata
CLUSTER.userdata: multipart/mixed; boundary="===============8094544984785845936==, ASCII text