CDIST(1)

πŸ’… cdist β€” bestie's guide to Usable Configuration Management

okay so welcome to cdist(1), the manual page for cdist, and honestly? she's that girl. Usable Configuration Management, periodt. Let's get into it, no cap.


✨ NAME ✨

cdist β€” Usable Configuration Management πŸŽ€


🌈 SYNOPSIS 🌈

cdist [-h] [-V] {banner,config,install,inventory,preos,shell,info} ...

cdist banner [-h] [-l LOGLEVEL] [-q] [-v]

cdist config [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
             [-g CONFIG_FILE] [-4] [-6] [-C CACHE_PATH_PATTERN]
             [-c CONF_DIR] [-i MANIFEST] [-j [JOBS]] [--log-server]
             [-n] [-o OUT_PATH] [-P] [-R [{tar,tgz,tbz2,txz}]]
             [-r REMOTE_OUT_PATH] [--remote-copy REMOTE_COPY]
             [--remote-exec REMOTE_EXEC] [-S] [-I INVENTORY_DIR] [-A]
             [-a] [-f HOSTFILE] [-p [HOST_MAX]] [-s] [-t]
             [host [host ...]]

cdist install [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
              [-g CONFIG_FILE] [-4] [-6] [-C CACHE_PATH_PATTERN]
              [-c CONF_DIR] [-i MANIFEST] [-j [JOBS]] [--log-server]
              [-n] [-o OUT_PATH] [-P] [-R [{tar,tgz,tbz2,txz}]]
              [-r REMOTE_OUT_PATH] [--remote-copy REMOTE_COPY]
              [--remote-exec REMOTE_EXEC] [-S] [-I INVENTORY_DIR] [-A]
              [-a] [-f HOSTFILE] [-p [HOST_MAX]] [-s] [-t]
              [host [host ...]]

cdist inventory [-h] {add-host,add-tag,del-host,del-tag,list} ...

cdist inventory add-host [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
                         [-g CONFIG_FILE] [-I INVENTORY_DIR] [-f HOSTFILE]
                         [host [host ...]]

cdist inventory add-tag [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
                        [-g CONFIG_FILE] [-I INVENTORY_DIR] [-f HOSTFILE]
                        [-T TAGFILE] [-t TAGLIST]
                        [host [host ...]]

cdist inventory del-host [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
                         [-g CONFIG_FILE] [-I INVENTORY_DIR] [-a]
                         [-f HOSTFILE]
                         [host [host ...]]

cdist inventory del-tag [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
                        [-g CONFIG_FILE] [-I INVENTORY_DIR] [-a]
                        [-f HOSTFILE] [-T TAGFILE] [-t TAGLIST]
                        [host [host ...]]

cdist inventory list [-h] [-l LOGLEVEL] [-q] [-v] [-b] [--colors WHEN]
                     [-g CONFIG_FILE] [-I INVENTORY_DIR] [-a] [-f HOSTFILE]
                     [-H] [-t]
                     [host [host ...]]

cdist preos [-h] [-l LOGLEVEL] [-q] [-v] [-c CONF_DIR] [-g CONFIG_FILE] [-L]
            [preos] ...

cdist preos [preos-options] debian [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
                                   [-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
                                   [-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
                                   [-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
                                   [-S SCRIPT] [-s SUITE] [-y REMOTE_COPY]
                                   target_dir

cdist preos [preos-options] devuan [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
                                   [-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
                                   [-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
                                   [-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
                                   [-S SCRIPT] [-s SUITE] [-y REMOTE_COPY]
                                   target_dir

cdist preos [preos-options] ubuntu [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-a ARCH] [-B]
                                   [-C] [-c CDIST_PARAMS] [-D DRIVE] [-e REMOTE_EXEC]
                                   [-i MANIFEST] [-k KEYFILE ] [-m MIRROR]
                                   [-P ROOT_PASSWORD] [-p PXE_BOOT_DIR] [-r]
                                   [-S SCRIPT] [-s SUITE] [-y REMOTE_COPY]
                                   target_dir

cdist shell [-h] [-l LOGLEVEL] [-q] [-v] [--colors WHEN] [-s SHELL]

cdist info [-h] [-a] [-c CONF_DIR] [-e] [-F] [-f] [-g CONFIG_FILE] [-t]
           [pattern]

cdist scan -I INTERFACE [--m MODE] [--name-mapper PATH_TO_SCRIPT] [--list]
           [-d CONFIG_DELAY] [-t TRIGGER_DELAY]

🌸 DESCRIPTION 🌸

So cdist is the frontend executable to the cdist configuration management. She's the main character πŸ’… and she supports a bunch of different subcommands β€” all explained below, don't worry bestie.

She's written in Python, so she needs python(1) installed to run. Minimum requirement? Python version 3.5. That's the vibe check. 🐍


πŸ¦‹ GENERAL πŸ¦‹

Every single command out here accepts these options. All of them. Universal. Slay.

  • -h, --help β€” shows you the help screen. your bestie when you're lost 🫢
  • --colors WHEN β€” colorizes cdist's output πŸ’– If enabled, cdist uses different colors for different log levels. WHEN recognizes the values 'always', 'never', and 'auto' (which is the default).
    • If the value is 'auto', colored output is enabled if stdout is a TTY β€” unless the NO_COLOR (https://no-color.org/) environment variable is defined. so if you set NO_COLOR, respect it, okay?
  • -l LOGLEVEL, --log-level LOGLEVEL β€” sets the specified verbosity level. The levels, in order from the lowest to the highest, are: ERROR (-1), WARNING (0), INFO (1), VERBOSE (2), DEBUG (3), TRACE (4 or higher). If used along with -v then -v increases the last set value and -l overwrites the last set value. it's giving teamwork, not competition πŸ’…
  • -q, --quiet β€” quiet mode: disables logging, including WARNING and ERROR. she's silent, she's mysterious 🀫
  • -v, --verbose β€” increases the verbosity level. Every instance of -v increments the verbosity level by one. Its default value is 0 which includes ERROR and WARNING levels. The levels, in order from the lowest to the highest, are: ERROR (-1), WARNING (0), INFO (1), VERBOSE (2), DEBUG (3), TRACE (4 or higher). If used along with -l then -l overwrites the last set value and -v increases the last set value.
  • -V, --version β€” shows the version and exits. bye bestie πŸ‘‹

Displays the cdist banner. Useful for printing cdist posters β€” and honestly? a must have for every office. no seriously, every office needs one. it's iconic. πŸ’–βœ¨


πŸ‘‘ CONFIG/INSTALL πŸ‘‘

Configure/install one or more hosts. Heads up though: the install command is currently in beta. πŸ§ͺ

  • -4, --force-ipv4 β€” force to use IPv4 addresses only. No influence for custom remote commands.
  • -6, --force-ipv6 β€” force to use IPv6 addresses only. No influence for custom remote commands.
  • -A, --all-tagged β€” use all hosts present in the tags db. Currently in beta.
  • -a, --all β€” list hosts that have all specified tags, if -t/--tag is specified.
  • -b, --beta β€” enable beta functionality. πŸ§ͺ
  • -C CACHE_PATH_PATTERN, --cache-path-pattern CACHE_PATH_PATTERN β€” specify a custom cache path pattern. If it is not set then the default hostdir is used. For more info on the format, see the CACHE PATH PATTERN FORMAT below. ⬇️
  • -c CONF_DIR, --conf-dir CONF_DIR β€” add a configuration directory. Can be specified multiple times. If configuration directories contain conflicting types, explorers or manifests, then the last one found is used. last one wins, bestie.
  • -f HOSTFILE, --file HOSTFILE β€” read the specified file for a list of additional hosts to operate on, or if '-' is given, read stdin (one host per line). For the file format see the HOSTFILE FORMAT below.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. The inventory directory is set up by these rules, in order: if cdist configuration resolves this value then the specified directory is used; if the HOME env var is set then ~/.cdit/inventory is used; otherwise the distribution inventory directory is used.
  • -i MANIFEST, --initial-manifest MANIFEST β€” path to a cdist manifest, or - to read from stdin.
  • -j [JOBS], --jobs [JOBS] β€” operate in parallel in the specified maximum number of jobs. Global explorers, object prepare and object run are supported. Without an argument, the CPU count is used by default. parallel besties πŸƒβ™€οΈπŸ’¨
  • --log-server β€” start a log server for sub processes to use. This is mainly useful when running cdist nested from a code-local script. The log server is always implicitly started for the 'install' command.
  • -n, --dry-run β€” do not execute code. all vibes, no action πŸ™ˆ
  • -o OUT_PATH, --out-dir OUT_PATH β€” directory to save cdist output in.
  • -P, --timestamp β€” timestamp log messages with the current local date and time in the format: YYYYMMDDHHMMSS.us.
  • -p [HOST_MAX], --parallel [HOST_MAX] β€” operate on multiple hosts in parallel for the specified maximum hosts at a time. Without an argument, the CPU count is used by default.
  • -R [{tar,tgz,tbz2,txz}], --use-archiving [{tar,tgz,tbz2,txz}] β€” operate by using archiving with compression where appropriate. Supported values are: tar β€” tar archive, tgz β€” gzip tar archive (the default), tbz2 β€” bzip2 tar archive and txz β€” lzma tar archive. Currently in beta.
  • -r REMOTE_OUT_PATH, --remote-out-dir REMOTE_OUT_PATH β€” directory to save cdist output in on the target host.
  • -S, --disable-saving-output-streams β€” disable saving output streams.
  • -s, --sequential β€” operate on multiple hosts sequentially (default). one at a time, calm and collected πŸ§˜β™€οΈ
  • --remote-copy REMOTE_COPY β€” command to use for remote copy (should behave like scp).
  • --remote-exec REMOTE_EXEC β€” command to use for remote execution (should behave like ssh).
  • -t, --tag β€” host is specified by tag, not hostname/address; list all hosts that contain any of the specified tags. Currently in beta.

πŸ“„ HOSTFILE FORMAT πŸ“„

The HOSTFILE contains one host per line. A comment is started with '#' and continues to the end of the line. Any leading and trailing whitespace on a line is ignored. Empty lines are ignored/skipped. ✨

The Hostfile lines are processed like this, bestie, step by step:

  1. First, all comments are removed.
  2. Then all leading and trailing whitespace characters are stripped.
  3. If such a line results in an empty line it is ignored/skipped.
  4. Otherwise, the host string is used.

πŸ—‚οΈ CACHE PATH PATTERN FORMAT πŸ—‚οΈ

The cache path pattern specifies the path for a cache directory subdirectory. In the path, '%N' will be substituted by the target host, '%h' will be substituted by the calculated host directory, and '%P' will be substituted by the current process id. All format codes that the python datetime.strftime() function supports β€” except '%h' β€” are supported. These date/time directives format the cdist config/install start time. ⏰

If an empty pattern is specified then the default calculated host directory is used.

The calculated host directory is a hash of a host cdist operates on. πŸ”

The resulting path is used to specify the cache path subdirectory under which the current host cache data are saved.


πŸ’Ύ INVENTORY πŸ’Ύ

Okay bestie, so this whole inventory database situation? Managing it. Currently in beta with all sub-commands, so like... it works, but it's giving "we're still cooking" energy. πŸ§‘β€πŸ³


πŸŽ€ INVENTORY ADD-HOST πŸŽ€

Adding host(s) to the inventory database. Slay. ✨

host β€” the host(s) you wanna add.

  • -b, --beta β€” turn on beta functionality.
  • -f HOSTFILE, --file HOSTFILE β€” read extra hosts to add from the specified file, or from stdin if it's '-' (each host on its own separate line). The hostfile format is the same as the config hostfile format.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. The inventory directory gets set up by these rules, bestie, listen up: if the cdist configuration resolves this value then the specified directory is used, if the HOME env var is set then ~/.cdit/inventory is used, otherwise the distribution inventory directory is used. 🏠

🌸 INVENTORY ADD-TAG 🌸

Adding tag(s) to the inventory database. Tagging era. 🏷️

host β€” the list of host(s) the tags get added for.

  • -b, --beta β€” turn on beta functionality.
  • -f HOSTFILE, --file HOSTFILE β€” read extra hosts to add tags from the specified file, or from stdin if it's '-' (each host on its own separate line). Hostfile format is the same as config hostfile format.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. Rules again, no cap: if the cdist configuration resolves this value then the specified directory is used, if HOME env var is set then ~/.cdit/inventory is used, otherwise the distribution inventory directory is used.
  • -T TAGFILE, --tag-file TAGFILE β€” read extra tags to add from the specified file, or from stdin if it's '-' (each tag on its own separate line). Tagfile format is the same as config hostfile format.
  • -t TAGLIST, --taglist TAGLIST β€” the tag list to be added for the specified host(s), comma separated values. πŸ“

πŸ¦‹ INVENTORY DEL-HOST πŸ¦‹

Deleting host(s) from the inventory database. Bye bestie, it's not you it's the database. πŸ’€

host β€” the host(s) to delete.

  • -a, --all β€” delete all the hosts. All of them. Periodt.
  • -b, --beta β€” turn on beta functionality.
  • -f HOSTFILE, --file HOSTFILE β€” read extra hosts to delete from the specified file, or from stdin if it's '-' (each host on its own separate line). Hostfile format is the same as config hostfile format.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. Same three rules as always: if the cdist configuration resolves this value then the specified directory is used, if HOME env var is set then ~/.cdit/inventory is used, otherwise the distribution inventory directory is used.

🌈 INVENTORY DEL-TAG 🌈

Deleting tag(s) from the inventory database. Un-tagging, we love to see it. βœ‚οΈ

host β€” the list of host(s) the tags get deleted for.

  • -a, --all β€” delete all tags for the specified host(s).
  • -b, --beta β€” turn on beta functionality.
  • -f HOSTFILE, --file HOSTFILE β€” read extra hosts to delete tags for from the specified file, or from stdin if it's '-' (each host on its own separate line). Hostfile format is the same as config hostfile format.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. You know the drill: if the cdist configuration resolves this value then the specified directory is used, if HOME env var is set then ~/.cdit/inventory is used, otherwise the distribution inventory directory is used.
  • -T TAGFILE, --tag-file TAGFILE β€” read extra tags from the specified file, or from stdin if it's '-' (each tag on its own separate line). Tagfile format is the same as config hostfile format.
  • -t TAGLIST, --taglist TAGLIST β€” the tag list to be deleted for the specified host(s), comma separated values. πŸŽ€

πŸ‘‘ INVENTORY LIST πŸ‘‘

Listing the inventory database. The main character reveal moment. ✨

host β€” the host(s) to list.

  • -a, --all β€” list hosts that have all specified tags, if -t/--tag is specified.
  • -b, --beta β€” turn on beta functionality.
  • -f HOSTFILE, --file HOSTFILE β€” read extra hosts to list from the specified file, or from stdin if it's '-' (each host on its own separate line). If no host or host file is specified then, by default, list all. Hostfile format is the same as config hostfile format.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -H, --host-only β€” suppress the tags listing. Just hosts, nothing else. πŸ™ˆ
  • -I INVENTORY_DIR, --inventory INVENTORY_DIR β€” use the specified custom inventory directory. Yup, the rules: if the cdist configuration resolves this value then the specified directory is used, if HOME env var is set then ~/.cdit/inventory is used, otherwise the distribution inventory directory is used.
  • -t, --tag β€” the host is specified by tag, not by hostname/address; list all hosts that contain any of the specified tags.

🧚 PREOS 🧚

Creating a PreOS. Baby's first bootable operating system, lowkey iconic. πŸ‘Ά

  • -c CONF_DIR, --conf-dir CONF_DIR β€” add configuration directory (one that contains a "preos" subdirectory).
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -L, --list-preoses β€” list the available PreOS-es.

Currently, the following PreOS-es are supported:

  • debian
  • ubuntu
  • devuan

⭐ PREOS DEBIAN/DEVUAN ⭐

target_dir β€” the target directory where the PreOS will be bootstrapped.

  • -a ARCH, --arch ARCH β€” target debootstrap architecture, by default 'amd64'.
  • -B, --bootstrap β€” do the bootstrap step.
  • -b, --beta β€” turn on beta functionality.
  • -C, --configure β€” do the configure step.
  • -c CDIST_PARAMS, --cdist-params CDIST_PARAMS β€” parameters that will be passed to cdist config, by default '-v' is used.
  • -D DRIVE, --drive-boot DRIVE β€” create a bootable PreOS on the specified drive.
  • -e REMOTE_EXEC, --remote-exec REMOTE_EXEC β€” the remote exec that cdist config will use, by default an internal script is used.
  • -i MANIFEST, --init-manifest MANIFEST β€” the init manifest that cdist config will use, by default an internal init manifest is used.
  • -k KEYFILE, --keyfile KEYFILE β€” ssh key files that will be added to cdist config; a '__ssh_authorized_keys root ...' type is appended to the initial manifest. πŸ”‘
  • -m MIRROR, --mirror MIRROR β€” use the specified mirror for debootstrap.
  • -P ROOT_PASSWORD, --root-password ROOT_PASSWORD β€” set the specified password for root, generated by default.
  • -p PXE_BOOT_DIR, --pxe-boot-dir PXE_BOOT_DIR β€” PXE boot directory.
  • -r, --rm-bootstrap-dir β€” remove the target directory after finishing.
  • -S SCRIPT, --script SCRIPT β€” use the specified script for debootstrap.
  • -s SUITE, --suite SUITE β€” the suite used for debootstrap, by default 'stable'.
  • -y REMOTE_COPY, --remote-copy REMOTE_COPY β€” the remote copy that cdist config will use, by default an internal script is used.

πŸ’œ PREOS UBUNTU πŸ’œ

target_dir β€” the target directory where the PreOS will be bootstrapped.

  • -a ARCH, --arch ARCH β€” target debootstrap architecture, by default 'amd64'.
  • -B, --bootstrap β€” do the bootstrap step.
  • -b, --beta β€” turn on beta functionality.
  • -C, --configure β€” do the configure step.
  • -c CDIST_PARAMS, --cdist-params CDIST_PARAMS β€” parameters that will be passed to cdist config, by default '-v' is used.
  • -D DRIVE, --drive-boot DRIVE β€” create a bootable PreOS on the specified drive.
  • -e REMOTE_EXEC, --remote-exec REMOTE_EXEC β€” the remote exec that cdist config will use, by default an internal script is used.
  • -i MANIFEST, --init-manifest MANIFEST β€” the init manifest that cdist config will use, by default an internal init manifest is used.
  • -k KEYFILE, --keyfile KEYFILE β€” ssh key files that will be added to cdist config; a '__ssh_authorized_keys root ...' type is appended to the initial manifest. πŸ”‘
  • -m MIRROR, --mirror MIRROR β€” use the specified mirror for debootstrap.
  • -P ROOT_PASSWORD, --root-password ROOT_PASSWORD β€” set the specified password for root, generated by default.
  • -p PXE_BOOT_DIR, --pxe-boot-dir PXE_BOOT_DIR β€” PXE boot directory.
  • -r, --rm-bootstrap-dir β€” remove the target directory after finishing.
  • -S SCRIPT, --script SCRIPT β€” use the specified script for debootstrap.
  • -s SUITE, --suite SUITE β€” the suite used for debootstrap, by default 'xenial'.
  • -y REMOTE_COPY, --remote-copy REMOTE_COPY β€” the remote copy that cdist config will use, by default an internal script is used.

🐚 SHELL 🐚

This command lets you spawn a shell that gives you access to the types as commands. Think of it as an "interactive manifest" environment, bestie β€” that's literally what it is. See below for example usage. Its main use is for debugging type parameters. πŸ”

  • -s SHELL, --shell SHELL β€” select the shell to use, defaults to the current shell. The shell you use should be a POSIX compatible shell. No zsh weirdness, we're keeping it POSIX. πŸ’…

ℹ️ INFO ℹ️

Displaying information for cdist (global explorers, types). The lore dump. πŸ“–

pattern β€” a glob pattern. If it contains special characters ('?', '*', '[') then it's used as specified, otherwise it gets translated to *pattern*.

  • -h, --help β€” show the help message and exit.
  • -a, --all β€” display all info. This is the default.
  • -c CONF_DIR, --conf-dir CONF_DIR β€” add configuration directory (can be repeated).
  • -e, --global-explorers β€” display info for global explorers.
  • -F, --fixed-string β€” interpret the pattern as a fixed string.
  • -f, --full β€” display full details.
  • -g CONFIG_FILE, --config-file CONFIG_FILE β€” use the specified custom configuration file.
  • -t, --types β€” display info for types.

πŸ” SCAN πŸ”

Okay bestie, this mode is main character energy for real β€” it runs cdist as a daemon that discovers/watches hosts and reconfigures them periodically. It's giving background-process-that-never-sleeps πŸ’…

  • -I INTERFACE, --interfaces INTERFACE β€” which interface to listen on. You can drop this flag multiple times if you've got multiple interfaces to vibe with. 🌐
  • -m MODE, --mode MODE β€” the scanner components you wanna enable. Say it more than once to turn on more than one component. The supported modes are: scan, trigger and config. Defaults to tiggger and scan. (yes the manpage really spells it tiggger, we keep it exactly, no cap 😭)
  • --name-mapper PATH_TO_SCRIPT β€” path to the script that resolves a remote host name from an IPv6 address. 🧚
  • --list β€” list known hosts and then exit. That's it, that's the whole job. ✨
  • -d CONFIG_DELAY, --config-delay CONFIG_DELAY β€” how long (in seconds) to wait before reconfiguring after the last try. config mode only, so don't come for it if you're in another mode. ⏳
  • -t TRIGGER_DELAY, --tigger-delay TRIGGER_DELAY β€” how long (in seconds) to wait between ICMPv6 echo requests. trigger mode only. (and yep, tigger-delay is spelled exactly like that in the original β€” iconic typo, we stan) 🐯

βš™οΈ CONFIGURATION βš™οΈ

So here's the tea on where cdist pulls its config data from β€” listed from higher to lower precedence:

  1. command-line options
  2. configuration file specified at command-line
  3. configuration file specified in CDIST_CONFIG_FILE environment variable
  4. environment variables
  5. user's configuration file (first one found of ~/.cdist.cfg, $XDG_CONFIG_HOME/cdist/cdist.cfg, in specified order)
  6. system-wide configuration file (/etc/cdist.cfg).

πŸ“ CONFIGURATION FILE FORMAT πŸ“

The cdist configuration file is in the INI file format. Right now it only supports the [GLOBAL] section β€” one section, one queen, no drama. πŸ‘‘

Here are all the possible keywords and what they actually mean:

  • archiving β€” use the specified archiving. Valid values include: 'none', 'tar', 'tgz', 'tbz2' and 'txz'.
  • beta β€” enable beta functionality. It recognizes boolean values from 'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0'.
  • cache_path_pattern β€” specify the cache path pattern.
  • colored_output β€” colorize cdist's output. cf. the --colors option.
  • conf_dir β€” list of configuration directories separated with the character conventionally used by the operating system to separate search path components (as in PATH), such as ':' for POSIX or ';' for Windows. If also specified at command line then values from command line are appended to this value.
  • init_manifest β€” specify the default initial manifest.
  • inventory_dir β€” specify the inventory directory.
  • jobs β€” specify number of jobs for parallel processing. If -1 then the default, number of CPU's in the system is used. If 0 then parallel processing in jobs is disabled. If set to a positive number then the specified maximum number of processes will be used.
  • local_shell β€” shell command used for local execution.
  • out_path β€” directory to save cdist output in.
  • parallel β€” process hosts in parallel. If -1 then the default, number of CPU's in the system is used. If 0 then parallel processing of hosts is disabled. If set to a positive number then the specified maximum number of processes will be used.
  • remote_copy β€” command to use for remote copy (should behave like scp).
  • remote_exec β€” command to use for remote execution (should behave like ssh).
  • remote_out_path β€” directory to save cdist output in on the target host.
  • remote_shell β€” shell command at remote host used for remote execution.
  • save_output_streams β€” enable/disable saving output streams (enabled by default). It recognizes boolean values from 'yes'/'no', 'on'/'off', 'true'/'false' and '1'/'0'.
  • timestamp β€” timestamp log messages with the current local date and time in the format: YYYYMMDDHHMMSS.us.
  • verbosity β€” set verbosity level. Valid values are: 'ERROR', 'WARNING', 'INFO', 'VERBOSE', 'DEBUG', 'TRACE' and 'OFF'.

πŸ“‚ FILES πŸ“‚

Here's every file and directory in cdist's little ecosystem, bestie πŸ¦‹

  • ~/.cdist β€” your personal cdist config directory. If it exists it will be automatically used.
  • ~/.cdist/cache β€” local cache directory.
  • ~/.cdist/inventory β€” the home inventory directory. If ~/.cdist exists it will be used as default inventory directory.
  • ~/.cdist/preos β€” PreOS plugins directory, if existing.
  • cdist/conf β€” the distribution configuration directory. It contains official types and explorers. This path is relative to the cdist installation directory.
  • cdist/inventory β€” the distribution inventory directory. This path is relative to the cdist installation directory.
  • cdist/preos β€” the distribution PreOS plugins directory.
  • /etc/cdist.cfg β€” global cdist configuration file, if exists.
  • ~/.cdist.cfg or $XDG_CONFIG_HOME/cdist/cdist.cfg β€” local cdist configuration file, if exists.

πŸ“Œ NOTES πŸ“Œ

cdist detects if a host is specified by IPv6 address. If so then the remote_copy command is executed with the host address enclosed in square brackets (see scp(1)). πŸ’…


🌈 EXAMPLES 🌈

Get ready, this is the fun part β€” a whole mood board of commands πŸŽ€

# Configure ikq05.ethz.ch with debug enabled
% cdist config -vvv ikq05.ethz.ch

# Configure hosts in parallel and use a different configuration directory
% cdist config -c ~/p/cdist-nutzung \
    -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch

# Use custom remote exec / copy commands
% cdist config --remote-exec /path/to/my/remote/exec \
    --remote-copy /path/to/my/remote/copy \
    -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch

# Configure hosts read from file loadbalancers
% cdist config -f loadbalancers

# Configure hosts read from file web.hosts using 16 parallel jobs
% cdist config -j 16 -f web.hosts

# Display banner
cdist banner

# Show help
% cdist --help

# Show Version
% cdist --version

# Enter a shell that has access to emulated types
% cdist shell
% __git
usage: __git --source SOURCE [--state STATE] [--branch BRANCH]
             [--group GROUP] [--owner OWNER] [--mode MODE] object_id

# Install ikq05.ethz.ch with debug enabled
% cdist install -vvv ikq05.ethz.ch

# List inventory content
% cdist inventory list -b

# List inventory for specified host localhost
% cdist inventory list -b localhost

# List inventory for specified tag loadbalancer
% cdist inventory list -b -t loadbalancer

# Add hosts to inventory
% cdist inventory add-host -b web1 web2 web3

# Delete hosts from file old-hosts from inventory
% cdist inventory del-host -b -f old-hosts

# Add tags to specified hosts
% cdist inventory add-tag -b -t europe,croatia,web,static web1 web2

# Add tag to all hosts in inventory
% cdist inventory add-tag -b -t vm

# Delete all tags from specified host
% cdist inventory del-tag -b -a localhost

# Delete tags read from stdin from hosts specified by file hosts
% cdist inventory del-tag -b -T - -f hosts

# Configure hosts from inventory with any of specified tags
% cdist config -b -t web dynamic

# Configure hosts from inventory with all specified tags
% cdist config -b -t -a web dynamic

# Configure all hosts from inventory db
$ cdist config -b -A

# Create default debian PreOS in debug mode
$ cdist preos debian /preos/preos-debian -vvvv -C \
    -k ~/.ssh/id_rsa.pub -p /preos/pxe-debian

# Create ubuntu PreOS
$ cdist preos ubuntu /preos/preos-ubuntu -C \
    -k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu

# Create ubuntu PreOS on drive /dev/sdb
# and set root password to 'password'.
$ cdist preos ubuntu /mnt -B -C \
    -k ~/.ssh/id_rsa.pub -D /dev/sdb \
    -P password

🌱 ENVIRONMENT 🌱

Environment variables are lowkey the backstage pass of cdist, bestie. Here's the full list:

  • TMPDIR, TEMP, TMP β€” setup the base directory for the temporary directory. See http://docs.python.org/py3k/library/tempfile.html for more information. This is rather useful, if the standard directory used does not allow executables.
  • CDIST_PATH β€” colon delimited list of config directories.
  • CDIST_LOCAL_SHELL β€” selects shell for local script execution, defaults to /bin/sh.
  • CDIST_REMOTE_SHELL β€” selects shell for remote script execution, defaults to /bin/sh.
  • CDIST_OVERRIDE β€” allow overwriting type parameters.
  • CDIST_ORDER_DEPENDENCY β€” create dependencies based on the execution order. Note that in version 6.2.0 semantic of this processing mode is finally fixed and well defined.
  • CDIST_REMOTE_EXEC β€” use this command for remote execution (should behave like ssh).
  • CDIST_REMOTE_COPY β€” use this command for remote copy (should behave like scp).
  • CDIST_INVENTORY_DIR β€” use this directory as inventory directory.
  • CDIST_BETA β€” enable beta functionality.
  • CDIST_CACHE_PATH_PATTERN β€” custom cache path pattern.
  • CDIST_COLORED_OUTPUT β€” colorize cdist's output. cf. the --colors option.
  • CDIST_CONFIG_FILE β€” custom configuration file.

πŸšͺ EXIT STATUS πŸšͺ

The following exit values shall be returned, no surprises here:

  • 0 β€” successful completion. slay. ✨
  • 1 β€” one or more host configurations failed. 😭

πŸ‘‘ AUTHORS πŸ‘‘

Originally written by Nico Schottelius <nico-cdist--@--schottelius.org> and Steven Armstrong <steven-cdist--@--armstrong.cc>. Legends, fr fr. 🫢

πŸ’€ CAVEATS πŸ’€

okay bestie, listen up, this is the real talk section, the one where we hold hands and read the fine print together 🫢

🌈 Parallelism & your poor SSH server

So when you run stuff in parallel β€” either by doing a whole host in parallel with -p/--parallel, or by running parallel jobs inside one host with -j/--jobs β€” and depending on what your target SSH server is and how it's configured, you might just… get your connections dropped. 😭 Yeah. This whole thing is governed by the sshd MaxStartups configuration option, so that's the knob to go look at.

You might also hit session open refusal. That's the ssh multiplexing vibe: you've hit the max number of open sessions allowed per network connection, and in that case ssh will just disable multiplexing on you. That limit is controlled by the sshd MaxSessions configuration option. Want the actual details? Go read sshd_config(5), she explains it way better than I can. πŸ’…

🧚 Dependency resolver drama (the manifest edition)

Now, when requirements for the same object get defined in different manifests β€” like, say, in the init manifest AND in some other type manifest β€” and those requirements differ, then the dependency resolver literally cannot detect the dependencies correctly. Not a skill issue, just how it is. πŸ™ˆ

Why? Because cdist cannot prepare all objects first and then run all objects afterwards. Some object can depend on the result of a type explorer(s), and explorers only get executed during the object run. So the ordering info just isn't there yet.

cdist will notice this case though, and it'll hit you with a warning message. Here's what that looks like:

init manifest:
    __a a
    require="__e/e" __b b
    require="__f/f" __c c
    __e e
    __f f
    require="__c/c" __d d
    __g g
    __h h

type __g manifest:
    require="__c/c __d/d" __a a

and then the warning itself, which is giving "I tried my best and my best was not enough" energy:

WARNING: cdisttesthost: Object __a/a already exists with requirements:
/usr/home/darko/ungleich/cdist/cdist/test/config/fixtures/manifest/init-deps-resolver /tmp/tmp.cdist.test.ozagkg54/local/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__g/manifest: set()
/tmp/tmp.cdist.test.ozagkg54/local/759547ff4356de6e3d9e08522b0d0807/data/conf/type/__g/manifest: {'__c/c', '__d/d'}
Dependency resolver could not handle dependencies as expected.
πŸŽ€ tldr bestie: if you define conflicting requirements for the same object in two different manifests, the resolver can't sort it out, cdist tells you, and you should go fix your manifests. Periodt.

πŸ‘‘ COPYING πŸ‘‘

Copyright (C) 2011-2020 Nico Schottelius. Free use of this software is granted under the terms of the GNU General Public License v3 or later (GPLv3+). Free as in freedom, slay. ✨


ungleich GmbH 2021


and that's the whole page, bestie!! πŸŽ‰ this part was version 7.0.0, dated Jul 31, 2022, and yes, the name of the page is literally CDIST(1) β€” iconic, no notes. go forth and configure, you absolute main character πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from