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 π«Ά--colorsWHEN β 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 theNO_COLOR(https://no-color.org/) environment variable is defined. so if you setNO_COLOR, respect it, okay?
- If the value is
-lLOGLEVEL,--log-levelLOGLEVEL β 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-vthen-vincreases the last set value and-loverwrites the last set value. it's giving teamwork, not competition π-q,--quietβ quiet mode: disables logging, includingWARNINGandERROR. she's silent, she's mysterious π€«-v,--verboseβ increases the verbosity level. Every instance of-vincrements the verbosity level by one. Its default value is0which includesERRORandWARNINGlevels. 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-lthen-loverwrites the last set value and-vincreases the last set value.-V,--versionβ shows the version and exits. bye bestie π
π BANNER π
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/--tagis specified.-b,--betaβ enable beta functionality. π§ͺ-CCACHE_PATH_PATTERN,--cache-path-patternCACHE_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. β¬οΈ-cCONF_DIR,--conf-dirCONF_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.-fHOSTFILE,--fileHOSTFILE β 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.-gCONFIG_FILE,--config-fileCONFIG_FILE β use the specified custom configuration file.-IINVENTORY_DIR,--inventoryINVENTORY_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 theHOMEenv var is set then~/.cdit/inventoryis used; otherwise the distribution inventory directory is used.-iMANIFEST,--initial-manifestMANIFEST β 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 π-oOUT_PATH,--out-dirOUT_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 andtxzβ lzma tar archive. Currently in beta.-rREMOTE_OUT_PATH,--remote-out-dirREMOTE_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-copyREMOTE_COPY β command to use for remote copy (should behave likescp).--remote-execREMOTE_EXEC β command to use for remote execution (should behave likessh).-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:
- First, all comments are removed.
- Then all leading and trailing whitespace characters are stripped.
- If such a line results in an empty line it is ignored/skipped.
- 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 theHOMEenv var is set then~/.cdit/inventoryis 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, ifHOMEenv var is set then~/.cdit/inventoryis 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, ifHOMEenv var is set then~/.cdit/inventoryis 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, ifHOMEenv var is set then~/.cdit/inventoryis 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/--tagis 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, ifHOMEenv var is set then~/.cdit/inventoryis 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 tocdist 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 thatcdist configwill use, by default an internal script is used.-i MANIFEST,--init-manifest MANIFESTβ the init manifest thatcdist configwill use, by default an internal init manifest is used.-k KEYFILE,--keyfile KEYFILEβ ssh key files that will be added tocdist 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 thatcdist configwill 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 tocdist 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 thatcdist configwill use, by default an internal script is used.-i MANIFEST,--init-manifest MANIFESTβ the init manifest thatcdist configwill use, by default an internal init manifest is used.-k KEYFILE,--keyfile KEYFILEβ ssh key files that will be added tocdist 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 thatcdist configwill 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,triggerandconfig. Defaults totigggerandscan. (yes the manpage really spells ittiggger, 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-delayis 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:
- command-line options
- configuration file specified at command-line
- configuration file specified in
CDIST_CONFIG_FILEenvironment variable - environment variables
- user's configuration file (first one found of
~/.cdist.cfg,$XDG_CONFIG_HOME/cdist/cdist.cfg, in specified order) - 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--colorsoption.conf_dirβ list of configuration directories separated with the character conventionally used by the operating system to separate search path components (as inPATH), 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-1then the default, number of CPU's in the system is used. If0then 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-1then the default, number of CPU's in the system is used. If0then 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 likescp).remote_execβ command to use for remote execution (should behave likessh).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~/.cdistexists 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.cfgor$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. Seehttp://docs.python.org/py3k/library/tempfile.htmlfor 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 version6.2.0semantic of this processing mode is finally fixed and well defined.CDIST_REMOTE_EXECβ use this command for remote execution (should behave likessh).CDIST_REMOTE_COPYβ use this command for remote copy (should behave likescp).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--colorsoption.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. β¨
π«Ά COPYRIGHT π«Ά
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
- fedora 43: cdist 7.0.0-16.fc43 Β· GPL-3.0-only
- fedora 44: cdist 7.0.0-18.fc44 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms