2011-03-09 08:52:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2014-04-12 17:42:37 +00:00
|
|
|
# 2010-2014 Nico Schottelius (nico-cdist at schottelius.org)
|
2014-03-20 17:53:19 +00:00
|
|
|
# 2014 Daniel Heule (hda at sfs.biz)
|
2011-03-09 08:52:43 +00:00
|
|
|
#
|
|
|
|
# This file is part of cdist.
|
|
|
|
#
|
|
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# cdist is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Generate manpage that lists available types
|
|
|
|
#
|
|
|
|
|
|
|
|
__cdist_pwd="$(pwd -P)"
|
|
|
|
__cdist_mydir="${0%/*}";
|
|
|
|
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
|
|
|
|
__cdist_myname=${0##*/};
|
|
|
|
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
|
|
|
|
|
|
|
filename="${__cdist_myname%.sh}"
|
2016-06-17 19:28:16 +00:00
|
|
|
dest="$__cdist_abs_mydir/$filename"
|
2011-03-09 08:52:43 +00:00
|
|
|
|
|
|
|
cd "$__cdist_abs_mydir"
|
|
|
|
|
2011-03-09 09:01:14 +00:00
|
|
|
exec > "$dest"
|
2011-03-09 08:52:43 +00:00
|
|
|
cat << eof
|
2016-06-17 19:28:16 +00:00
|
|
|
Reference
|
|
|
|
=========
|
|
|
|
Variable, path and type reference for cdist
|
2016-06-23 14:08:59 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Explorers
|
2011-05-10 14:44:48 +00:00
|
|
|
---------
|
2012-01-09 15:29:28 +00:00
|
|
|
The following global explorers are available:
|
2011-05-10 14:44:48 +00:00
|
|
|
|
|
|
|
eof
|
|
|
|
(
|
2012-10-29 22:28:27 +00:00
|
|
|
cd ../../cdist/conf/explorer
|
2016-05-26 17:48:29 +00:00
|
|
|
for explorer in $(ls * | LC_ALL=C sort); do
|
2012-02-13 10:30:11 +00:00
|
|
|
echo "- $explorer"
|
|
|
|
done
|
2011-05-10 14:44:48 +00:00
|
|
|
)
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2011-05-10 14:44:48 +00:00
|
|
|
cat << eof
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Paths
|
2011-03-09 08:34:53 +00:00
|
|
|
-----
|
2016-05-20 06:50:56 +00:00
|
|
|
\$HOME/.cdist
|
2016-07-20 06:16:58 +00:00
|
|
|
The standard cdist configuration directory relative to your home directory.
|
|
|
|
This is usually the place you want to store your site specific configuration.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
cdist/conf/
|
2016-07-20 06:16:58 +00:00
|
|
|
The distribution configuration directory.
|
|
|
|
This contains types and explorers to be used.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2017-07-20 20:04:44 +00:00
|
|
|
cdist/inventory/
|
|
|
|
The distribution inventory directory.
|
|
|
|
This path is relative to cdist installation directory.
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir
|
2012-12-09 22:26:11 +00:00
|
|
|
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.
|
2012-12-09 22:41:50 +00:00
|
|
|
By default it consists of everything in \$HOME/.cdist and cdist/conf/.
|
2016-07-20 06:16:58 +00:00
|
|
|
For more details see cdist(1).
|
2012-12-09 22:26:11 +00:00
|
|
|
|
2016-07-15 22:49:24 +00:00
|
|
|
confdir/files/
|
|
|
|
Cdist does not care about this directory besides providing access to it.
|
|
|
|
It is thought to be a general file storage area.
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/manifest/init
|
2012-09-21 18:23:03 +00:00
|
|
|
This is the central entry point.
|
2012-02-13 10:30:11 +00:00
|
|
|
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.
|
2012-09-21 18:23:03 +00:00
|
|
|
Its intent is to used to define mapping from configurations to hosts.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/manifest/*
|
2012-02-13 10:30:11 +00:00
|
|
|
All other files in this directory are not directly used by cdist, but you
|
2015-05-19 09:58:50 +00:00
|
|
|
can separate configuration mappings, if you have a lot of code in the
|
2012-09-21 18:23:03 +00:00
|
|
|
conf/manifest/init file. This may also be helpful to have different admins
|
2012-02-13 10:30:11 +00:00
|
|
|
maintain different groups of hosts.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/explorer/<name>
|
2016-06-17 19:28:16 +00:00
|
|
|
Contains explorers to be run on the target hosts, see \`cdist explorer <cdist-explorer.html>\`_.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/
|
2012-02-13 10:30:11 +00:00
|
|
|
Contains all available types, which are used to provide
|
2016-06-17 19:28:16 +00:00
|
|
|
some kind of functionality. See \`cdist type <cdist-type.html>\`_.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/
|
2012-02-13 10:30:11 +00:00
|
|
|
Home of the type <name>.
|
|
|
|
This directory is referenced by the variable __type (see below).
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/man.rst
|
2016-07-20 06:16:58 +00:00
|
|
|
Manpage in reStructuredText format (required for inclusion into upstream).
|
2011-03-09 12:06:23 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/manifest
|
2012-02-13 10:30:11 +00:00
|
|
|
Used to generate additional objects from a type.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/gencode-local
|
2016-07-20 06:16:58 +00:00
|
|
|
Used to generate code to be executed on the source host.
|
2011-03-19 22:36:58 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/gencode-remote
|
2016-07-20 06:16:58 +00:00
|
|
|
Used to generate code to be executed on the target host.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/parameter/required
|
2015-05-19 09:58:50 +00:00
|
|
|
Parameters required by type, \n separated list.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/parameter/optional
|
2015-05-19 09:58:50 +00:00
|
|
|
Parameters optionally accepted by type, \n separated list.
|
2012-02-16 09:17:09 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/parameter/default/*
|
2013-09-04 20:23:01 +00:00
|
|
|
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.
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/parameter/boolean
|
2015-05-19 09:58:50 +00:00
|
|
|
Boolean parameters accepted by type, \n separated list.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/explorer
|
2012-02-13 10:30:11 +00:00
|
|
|
Location of the type specific explorers.
|
|
|
|
This directory is referenced by the variable __type_explorer (see below).
|
2016-06-17 19:28:16 +00:00
|
|
|
See \`cdist explorer <cdist-explorer.html>\`_.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
confdir/type/<name>/files
|
2012-12-09 22:26:11 +00:00
|
|
|
This directory is reserved for user data and will not be used
|
2014-01-27 13:15:41 +00:00
|
|
|
by cdist at any time. It can be used for storing supplementary
|
|
|
|
files (like scripts to act as a template or configuration files).
|
2012-12-09 22:26:11 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
out/
|
2012-02-13 10:30:11 +00:00
|
|
|
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).
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
out/explorer
|
2012-02-13 10:30:11 +00:00
|
|
|
Output of general explorers.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
out/object
|
2012-02-13 10:30:11 +00:00
|
|
|
Objects created for the host.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
out/object/<object>
|
2012-02-13 10:30:11 +00:00
|
|
|
Contains all object specific information.
|
|
|
|
This directory is referenced by the variable __object (see below).
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
out/object/<object>/explorers
|
2012-02-13 10:30:11 +00:00
|
|
|
Output of type specific explorers, per object.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Types
|
2011-03-09 08:52:43 +00:00
|
|
|
-----
|
2011-04-05 19:08:09 +00:00
|
|
|
The following types are available:
|
2011-04-06 07:32:11 +00:00
|
|
|
|
2011-04-05 19:08:09 +00:00
|
|
|
eof
|
2014-03-20 17:53:19 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
# If there is no such file then ls prints error to stderr,
|
|
|
|
# so redirect stderr to /dev/null.
|
|
|
|
for type in $(ls man7/cdist-type__*.rst 2>/dev/null | LC_ALL=C sort); do
|
2012-02-13 10:30:11 +00:00
|
|
|
no_dir="${type#man7/}";
|
|
|
|
no_type="${no_dir#cdist-type}";
|
2016-05-20 06:50:56 +00:00
|
|
|
name="${no_type%.rst}";
|
|
|
|
manref="${no_dir%.rst}"
|
|
|
|
man="${manref}(7)"
|
2011-04-06 07:32:11 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
echo "- $name" "(\`${man} <man7/${manref}.html>\`_)"
|
2011-04-05 19:08:09 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
cat << eof
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2011-06-17 12:14:32 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Objects
|
2011-09-23 11:49:02 +00:00
|
|
|
-------
|
|
|
|
For object to object communication and tests, the following paths are
|
|
|
|
usable within a object directory:
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
files
|
2014-01-27 13:15:41 +00:00
|
|
|
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).
|
2016-05-20 06:50:56 +00:00
|
|
|
changed
|
2012-02-13 10:30:11 +00:00
|
|
|
This empty file exists in an object directory, if the object has
|
2016-07-20 06:16:58 +00:00
|
|
|
code to be executed (either remote or local).
|
2016-05-20 06:50:56 +00:00
|
|
|
stdin
|
2014-01-27 13:15:41 +00:00
|
|
|
This file exists and contains data, if data was provided on stdin
|
|
|
|
when the type was called.
|
2011-09-23 11:49:02 +00:00
|
|
|
|
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Environment variables (for reading)
|
2014-02-05 19:50:59 +00:00
|
|
|
-----------------------------------
|
|
|
|
The following environment variables are exported by cdist:
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
__explorer
|
2012-02-13 10:30:11 +00:00
|
|
|
Directory that contains all global explorers.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, explorer, type explorer, shell.
|
2016-07-15 22:49:24 +00:00
|
|
|
__files
|
|
|
|
Directory that contains content from the "files" subdirectories
|
|
|
|
from the configuration directories.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, type manifest, type gencode, shell.
|
2016-05-20 06:50:56 +00:00
|
|
|
__manifest
|
2012-02-13 10:30:11 +00:00
|
|
|
Directory that contains the initial manifest.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, type manifest, shell.
|
2016-05-20 06:50:56 +00:00
|
|
|
__global
|
2012-02-13 10:30:11 +00:00
|
|
|
Directory that contains generic output like explorer.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, type manifest, type gencode, shell.
|
2016-05-20 06:50:56 +00:00
|
|
|
__messages_in
|
2014-09-21 10:53:04 +00:00
|
|
|
File to read messages from.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, type manifest, type gencode.
|
2016-05-20 06:50:56 +00:00
|
|
|
__messages_out
|
2014-09-21 10:53:04 +00:00
|
|
|
File to write messages.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: initial manifest, type manifest, type gencode.
|
2016-05-20 06:50:56 +00:00
|
|
|
__object
|
2012-02-13 10:30:11 +00:00
|
|
|
Directory that contains the current object.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: type manifest, type explorer, type gencode and code scripts.
|
2016-05-20 06:50:56 +00:00
|
|
|
__object_id
|
2012-02-13 10:30:11 +00:00
|
|
|
The type unique object id.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: type manifest, type explorer, type gencode and code scripts.
|
2012-02-13 10:30:11 +00:00
|
|
|
Note: The leading and the trailing "/" will always be stripped (caused by
|
|
|
|
the filesystem database and ensured by the core).
|
|
|
|
Note: Double slashes ("//") will not be fixed and result in an error.
|
2016-05-20 06:50:56 +00:00
|
|
|
__object_name
|
2012-02-13 10:30:11 +00:00
|
|
|
The full qualified name of the current object.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: type manifest, type explorer, type gencode.
|
2016-05-20 06:50:56 +00:00
|
|
|
__target_host
|
2016-08-10 21:56:56 +00:00
|
|
|
The host we are deploying to. This is primary variable. It's content is
|
|
|
|
literally the one user passed in.
|
|
|
|
Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.
|
|
|
|
__target_hostname
|
|
|
|
The hostname of host we are deploying to. This variable is derived from
|
|
|
|
**__target_host** (using **socket.getaddrinfo(__target_host)** and then
|
|
|
|
**socket.gethostbyaddr()**).
|
|
|
|
Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.
|
|
|
|
__target_fqdn
|
|
|
|
The fully qualified domain name of the host we are deploying to.
|
|
|
|
This variable is derived from **__target_host**
|
|
|
|
(using **socket.getfqdn()**).
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.
|
2017-07-20 20:04:44 +00:00
|
|
|
__target_host_tags
|
|
|
|
Comma separated list of target host tags.
|
|
|
|
Available for: explorer, initial manifest, type explorer, type manifest, type gencode, shell.
|
2016-05-20 06:50:56 +00:00
|
|
|
__type
|
2012-02-13 10:30:11 +00:00
|
|
|
Path to the current type.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: type manifest, type gencode.
|
2016-05-20 06:50:56 +00:00
|
|
|
__type_explorer
|
2012-02-13 10:30:11 +00:00
|
|
|
Directory that contains the type explorers.
|
2016-07-20 06:16:58 +00:00
|
|
|
Available for: type explorer.
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-06-17 19:28:16 +00:00
|
|
|
Environment variables (for writing)
|
2014-02-05 19:50:59 +00:00
|
|
|
-----------------------------------
|
|
|
|
The following environment variables influence the behaviour of cdist:
|
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
require
|
2016-07-20 06:16:58 +00:00
|
|
|
Setup dependencies between objects (see \`cdist manifest <cdist-manifest.html>\`_).
|
|
|
|
|
|
|
|
CDIST_PATH
|
|
|
|
Colon delimited list of config directories.
|
2014-02-05 19:52:35 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_LOCAL_SHELL
|
2016-07-20 06:16:58 +00:00
|
|
|
Use this shell locally instead of /bin/sh to execute scripts.
|
2014-04-12 17:42:37 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_REMOTE_SHELL
|
2016-07-20 06:16:58 +00:00
|
|
|
Use this shell remotely instead of /bin/sh to execute scripts.
|
2014-04-12 17:41:39 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_OVERRIDE
|
2016-07-20 06:16:58 +00:00
|
|
|
Allow overwriting type parameters (see \`cdist manifest <cdist-manifest.html>\`_).
|
2011-03-09 08:34:53 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_ORDER_DEPENDENCY
|
2016-07-20 06:16:58 +00:00
|
|
|
Create dependencies based on the execution order (see \`cdist manifest <cdist-manifest.html>\`_).
|
2014-02-07 23:14:42 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_REMOTE_EXEC
|
2016-07-20 06:16:58 +00:00
|
|
|
Use this command for remote execution (should behave like ssh).
|
2016-03-18 22:34:02 +00:00
|
|
|
|
2016-05-20 06:50:56 +00:00
|
|
|
CDIST_REMOTE_COPY
|
2016-07-20 06:16:58 +00:00
|
|
|
Use this command for remote copy (should behave like scp).
|
2016-12-04 19:27:42 +00:00
|
|
|
|
2017-07-20 20:04:44 +00:00
|
|
|
CDIST_INVENTORY_DIR
|
|
|
|
Use this directory as inventory directory.
|
|
|
|
|
2016-12-04 19:27:42 +00:00
|
|
|
CDIST_BETA
|
|
|
|
Enable beta functionalities.
|
2017-07-01 21:59:51 +00:00
|
|
|
|
|
|
|
CDIST_CACHE_PATH_PATTERN
|
|
|
|
Custom cache path pattern.
|
2011-03-09 08:52:43 +00:00
|
|
|
eof
|