This site uses cookies for analytics. By continuing to browse this site, you agree to use this.  Learn more

How to use cdist trigger

Dear cdist users, trigger command is here!

Posted on June 11, 2017

As you all know you can use cdist to install and configure hosts.

Installing host means setting host for the first time. Installation includes actions like creating partitions, installing bootloader, generating fstab, etc. When operating in install mode cdist uses only install types.

Configuring host means setting things at already prepared host: entries in configuration files, installing packages, setting ssh keys, adding users, etc. When operating in config mode cdist uses only config types.

And all of you are familiar with its push architecture where no central server is needed and can be run from any computer:

cdist_push.jpg

cdist host initiates installation/configuration by executing cdist install/config command.

Although still in beta, cdist now supports triggering for host installation and configuration. It now has a trigger command. It starts trigger server at management node. cdist trigger server accepts simple requests for configuration and for installation:

  • /install/.* for installation
  • /config/.* for configuration.

Machines can then trigger cdist trigger server with appropriate requests. If the request is, for example, for installation then cdist trigger server will start install command for the client host using parameters specified at trigger command startup.

cdist_pull.jpg

Server hosts initiate installation/configuration of themselves when they are ready by triggering cdist trigger server. Only then trigger server starts installation/configuration by executing cdist install/config command.

Trigger command supports the most of the install/config options with the addition of its own like -H HTTP_PORT (see cdist(1) man page for more info).

Note that, currently, trigger command supports only HTTP requests.

Example

If you want to start cdist trigger server at port 5000, listening to both IPv4 and IPv6, using initial manifest ~/.cdist/manifest/install-after-first-boot then you will start cdist trigger server with the following command:

$ cdist trigger -b -H 5000 -6 -i ~/.cdist/manifest/install-after-first-boot

Client host can then be set up to execute trigger request at boot (assuming that trigger host is at address 192.168.111.5):

$ /usr/bin/curl 192.168.111.5:5000/install/

When client host executes above command HTTP request is sent to 192.168.111.5:5000. At trigger host cdist trigger server is then triggered. It detects that install is requested. It uses host's address and starts cdist install command for that host.

If trigger server should be used for configuration then trigger request should be:

$ /usr/bin/curl 192.168.111.5:5000/config/

In this case trigger server starts cdist config command for host.