<h1><spanclass="section-number">24. </span>Reference<aclass="headerlink"href="#reference"title="Permalink to this heading">¶</a></h1>
<p>Variable, path and type reference for cdist</p>
<sectionid="explorers">
<h2><spanclass="section-number">24.1. </span>Explorers<aclass="headerlink"href="#explorers"title="Permalink to this heading">¶</a></h2>
<p>The following global explorers are available:</p>
<ulclass="simple">
<li><p>cpu_cores</p></li>
<li><p>cpu_sockets</p></li>
<li><p>disks</p></li>
<li><p>hostname</p></li>
<li><p>init</p></li>
<li><p>interfaces</p></li>
<li><p>is-freebsd-jail</p></li>
<li><p>kernel_name</p></li>
<li><p>lsb_codename</p></li>
<li><p>lsb_description</p></li>
<li><p>lsb_id</p></li>
<li><p>lsb_release</p></li>
<li><p>machine</p></li>
<li><p>machine_type</p></li>
<li><p>memory</p></li>
<li><p>os</p></li>
<li><p>os_release</p></li>
<li><p>os_version</p></li>
<li><p>runlevel</p></li>
</ul>
</section>
<sectionid="paths">
<h2><spanclass="section-number">24.2. </span>Paths<aclass="headerlink"href="#paths"title="Permalink to this heading">¶</a></h2>
<dlclass="simple">
<dt>$HOME/.cdist</dt><dd><p>The standard cdist configuration directory relative to your home directory.
This is usually the place you want to store your site specific configuration.</p>
</dd>
<dt>cdist/conf/</dt><dd><p>The distribution configuration directory.
This contains types and explorers to be used.</p>
</dd>
<dt>cdist/inventory/</dt><dd><p>The distribution inventory directory.
This path is relative to cdist installation directory.</p>
</dd>
<dt>cdist/preos/</dt><dd><p>The distribution PreOS plugins directory.</p>
</dd>
<dt>confdir</dt><dd><p>Cdist will use all available configuration directories and create
a temporary confdir containing links to the real configuration directories.
This way it is possible to merge configuration directories.
By default it consists of everything in $HOME/.cdist and cdist/conf/.
For more details see cdist(1).</p>
</dd>
<dt>confdir/files/</dt><dd><p>Cdist does not care about this directory besides providing access to it.
It is thought to be a general file storage area.</p>
</dd>
<dt>confdir/manifest/init</dt><dd><p>This is the central entry point.
It is an executable (+x bit set) shell script that can use
values from the explorers to decide which configuration to create
for the specified target host.
Its intent is to used to define mapping from configurations to hosts.</p>
</dd>
<dt>confdir/manifest/*</dt><dd><p>All other files in this directory are not directly used by cdist, but you
can separate configuration mappings, if you have a lot of code in the
conf/manifest/init file. This may also be helpful to have different admins
maintain different groups of hosts.</p>
</dd>
<dt>confdir/explorer/<name></dt><dd><p>Contains explorers to be run on the target hosts, see <aclass="reference external"href="cdist-explorer.html">cdist explorer</a>.</p>
</dd>
<dt>confdir/type/</dt><dd><p>Contains all available types, which are used to provide
some kind of functionality. See <aclass="reference external"href="cdist-type.html">cdist type</a>.</p>
</dd>
<dt>confdir/type/<name>/</dt><dd><p>Home of the type <name>.
This directory is referenced by the variable __type (see below).</p>
</dd>
<dt>confdir/type/<name>/man.rst</dt><dd><p>Manpage in reStructuredText format (required for inclusion into upstream).</p>
</dd>
<dt>confdir/type/<name>/manifest</dt><dd><p>Used to generate additional objects from a type.</p>
</dd>
<dt>confdir/type/<name>/gencode-local</dt><dd><p>Used to generate code to be executed on the source host.</p>
</dd>
<dt>confdir/type/<name>/gencode-remote</dt><dd><p>Used to generate code to be executed on the target host.</p>
</dd>
<dt>confdir/type/<name>/parameter/required</dt><dd><p>Parameters required by type, n separated list.</p>
</dd>
<dt>confdir/type/<name>/parameter/optional</dt><dd><p>Parameters optionally accepted by type, n separated list.</p>
</dd>
<dt>confdir/type/<name>/parameter/default/*</dt><dd><p>Default values for optional parameters.
Assuming an optional parameter name of 'foo', it's default value would
be read from the file confdir/type/<name>/parameter/default/foo.</p>
</dd>
<dt>confdir/type/<name>/parameter/boolean</dt><dd><p>Boolean parameters accepted by type, n separated list.</p>
</dd>
<dt>confdir/type/<name>/explorer</dt><dd><p>Location of the type specific explorers.
This directory is referenced by the variable __type_explorer (see below).
See <aclass="reference external"href="cdist-explorer.html">cdist explorer</a>.</p>
</dd>
<dt>confdir/type/<name>/files</dt><dd><p>This directory is reserved for user data and will not be used
by cdist at any time. It can be used for storing supplementary
files (like scripts to act as a template or configuration files).</p>
</dd>
<dt>out/</dt><dd><p>This directory contains output of cdist and is usually located
in a temporary directory and thus will be removed after the run.
This directory is referenced by the variable __global (see below).</p>
</dd>
<dt>out/explorer</dt><dd><p>Output of general explorers.</p>
</dd>
<dt>out/object</dt><dd><p>Objects created for the host.</p>
</dd>
<dt>out/object/<object></dt><dd><p>Contains all object specific information.
This directory is referenced by the variable __object (see below).</p>
</dd>
<dt>out/object/<object>/explorers</dt><dd><p>Output of type specific explorers, per object.</p>
</dd>
</dl>
</section>
<sectionid="types">
<h2><spanclass="section-number">24.3. </span>Types<aclass="headerlink"href="#types"title="Permalink to this heading">¶</a></h2>
<h2><spanclass="section-number">24.4. </span>Objects<aclass="headerlink"href="#objects"title="Permalink to this heading">¶</a></h2>
<p>For object to object communication and tests, the following paths are
usable within a object directory:</p>
<dlclass="simple">
<dt>files</dt><dd><p>This directory is reserved for user data and will not be used
by cdist at any time. It can be used freely by the type
(for instance to store template results).</p>
</dd>
<dt>changed</dt><dd><p>This empty file exists in an object directory, if the object has
code to be executed (either remote or local).</p>
</dd>
<dt>stdin</dt><dd><p>This file exists and contains data, if data was provided on stdin
when the type was called.</p>
</dd>
</dl>
</section>
<sectionid="environment-variables-for-reading">
<h2><spanclass="section-number">24.5. </span>Environment variables (for reading)<aclass="headerlink"href="#environment-variables-for-reading"title="Permalink to this heading">¶</a></h2>
<p>The following environment variables are exported by cdist:</p>
<dl>
<dt>__cdist_log_level, __cdist_log_level_name</dt><dd><p>cdist log level value and cdist log level name. One of:</p>
<p>Available for: initial manifest, explorer, type manifest, type explorer,
type gencode.</p>
</dd>
<dt>__cdist_colored_log</dt><dd><p>whether or not cdist's log has colors enabled.
Is set to the string true if cdist's output is using colors,
otherwise the variable contains the string false.</p>
<p>Available for: initial manifest, explorer, type manifest, type explorer,
type gencode.</p>
</dd>
<dt>__cdist_dry_run</dt><dd><p>Is set only when doing dry run (-n flag).</p>
<p>Available for: initial manifest, explorer, type manifest, type explorer,
type gencode.</p>
</dd>
<dt>__explorer</dt><dd><p>Directory that contains all global explorers.</p>
<p>Available for: initial manifest, explorer, type explorer, shell.</p>
</dd>
<dt>__files</dt><dd><p>Directory that contains content from the "files" subdirectories
from the configuration directories.</p>
<p>Available for: initial manifest, type manifest, type gencode, shell.</p>
</dd>
<dt>__manifest</dt><dd><p>Directory that contains the initial manifest.</p>
<p>Available for: initial manifest, type manifest, shell.</p>
</dd>
<dt>__global</dt><dd><p>Directory that contains generic output like explorer.</p>
<p>Available for: initial manifest, type manifest, type gencode, shell.</p>
</dd>
<dt>__messages_in</dt><dd><p>File to read messages from.</p>
<p>Available for: initial manifest, type manifest, type gencode.</p>
</dd>
<dt>__messages_out</dt><dd><p>File to write messages.</p>
<p>Available for: initial manifest, type manifest, type gencode.</p>
</dd>
<dt>__object</dt><dd><p>Directory that contains the current object.</p>
<p>Available for: type manifest, type explorer, type gencode and code scripts.</p>
</dd>
<dt>__object_id</dt><dd><p>The type unique object id.</p>
<p>Available for: type manifest, type explorer, type gencode and code scripts.</p>
<divclass="line-block">
<divclass="line">Note: The leading and the trailing "/" will always be stripped (caused by
the filesystem database and ensured by the core).</div>
<divclass="line">Note: Double slashes ("//") will not be fixed and result in an error.</div>
</div>
</dd>
<dt>__object_name</dt><dd><p>The full qualified name of the current object.</p>
<p>Available for: type manifest, type explorer, type gencode.</p>
</dd>
<dt>__target_host</dt><dd><p>The host we are deploying to. This is primary variable. It's content is
literally the one user passed in.</p>
<p>Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.</p>
</dd>
<dt>__target_hostname</dt><dd><p>The hostname of host we are deploying to. This variable is derived from
<strong>__target_host</strong> (using <strong>socket.getaddrinfo(__target_host)</strong> and then
<strong>socket.gethostbyaddr()</strong>).</p>
<p>Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.</p>
</dd>
<dt>__target_fqdn</dt><dd><p>The fully qualified domain name of the host we are deploying to.
This variable is derived from <strong>__target_host</strong>
(using <strong>socket.getfqdn()</strong>).</p>
<p>Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.</p>
</dd>
<dt>__target_host_tags</dt><dd><p>Comma separated list of target host tags.</p>
<p>Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.</p>
</dd>
<dt>__type</dt><dd><p>Path to the current type.</p>
<p>Available for: type manifest, type gencode.</p>
</dd>
<dt>__type_explorer</dt><dd><p>Directory that contains the type explorers.</p>
<p>Available for: type explorer.</p>
</dd>
</dl>
</section>
<sectionid="environment-variables-for-writing">
<h2><spanclass="section-number">24.6. </span>Environment variables (for writing)<aclass="headerlink"href="#environment-variables-for-writing"title="Permalink to this heading">¶</a></h2>
<p>The following environment variables influence the behaviour of cdist:</p>
<dl>
<dt>require</dt><dd><p>Setup dependencies between objects (see <aclass="reference external"href="cdist-manifest.html">cdist manifest</a>).</p>
</dd>
<dt>__cdist_log_level</dt><dd><p>cdist log level value. One of:</p>
accordance with configuration rules. If cdist invokation is used
in types then nested cdist will honor this specified log level if
not specified otherwise while invoking it.</p>
</dd>
<dt>CDIST_PATH</dt><dd><p>Colon delimited list of config directories.</p>
</dd>
<dt>CDIST_LOCAL_SHELL</dt><dd><p>Use this shell locally instead of /bin/sh to execute scripts.</p>
</dd>
<dt>CDIST_REMOTE_SHELL</dt><dd><p>Use this shell remotely instead of /bin/sh to execute scripts.</p>
</dd>
<dt>CDIST_OVERRIDE</dt><dd><p>Allow overwriting type parameters (see <aclass="reference external"href="cdist-manifest.html">cdist manifest</a>).</p>
</dd>
<dt>CDIST_ORDER_DEPENDENCY</dt><dd><p>Create dependencies based on the execution order (see <aclass="reference external"href="cdist-manifest.html">cdist manifest</a>).
Note that in version 6.2.0 semantic of this processing mode is finally fixed and well defined.</p>
</dd>
<dt>CDIST_REMOTE_EXEC</dt><dd><p>Use this command for remote execution (should behave like ssh).</p>
</dd>
<dt>CDIST_REMOTE_COPY</dt><dd><p>Use this command for remote copy (should behave like scp).</p>
</dd>
<dt>CDIST_INVENTORY_DIR</dt><dd><p>Use this directory as inventory directory.</p>