2011-02-26 19:41:33 +00:00
|
|
|
cdist-manifest(7)
|
|
|
|
=================
|
|
|
|
Nico Schottelius <nico-cdist--@--schottelius.org>
|
|
|
|
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2012-01-16 17:11:28 +00:00
|
|
|
cdist-manifest - Using types
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
Manifests exist to define which configurations should be applied to a specific
|
|
|
|
host as well as to define which configurations should be applied within a
|
|
|
|
type. Manifests are executed locally and the resulting objects are stored in
|
|
|
|
an internal database.
|
|
|
|
|
|
|
|
The same object can be redefined in multiple different manifests as long as
|
|
|
|
the parameters are exactly the same.
|
|
|
|
|
|
|
|
In general, manifests are used to define which types are used depending
|
|
|
|
on given conditions.
|
2011-02-26 19:41:33 +00:00
|
|
|
|
|
|
|
|
2012-01-11 16:21:38 +00:00
|
|
|
DEFINE STATE IN THE INITIAL MANIFEST
|
|
|
|
------------------------------------
|
|
|
|
The **initial manifest** is the entry point for cdist to find out, which
|
|
|
|
**objects** to configure on the selected host. Objects are instances of
|
|
|
|
**types**, like in object orientated programming languages.
|
|
|
|
An object is represented by the
|
|
|
|
type + slash + object name: ***__file/etc/cdist-configured*** is an
|
|
|
|
object of the type ***__file*** with the name ***etc/cdist-configured***.
|
|
|
|
|
|
|
|
Cdist searches for the initial manifest at **conf/manifest/init** and
|
|
|
|
executes it as a shell script using **/bin/sh -e**.
|
|
|
|
|
|
|
|
Within this initial manifest, you define, which objects should be
|
|
|
|
created on which host. To distinguish between hosts, you can use the
|
|
|
|
environment variable **__target_host**. Let's have a look at a simple
|
|
|
|
example:
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
__cdistmarker
|
|
|
|
|
|
|
|
case "$__target_host" in
|
|
|
|
localhost)
|
|
|
|
__directory /home/services/kvm-vm --parents yes
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
This manifest says: Independent of the host, always use the type
|
|
|
|
***__cdistmarker***, which creates the file **/etc/cdist-configured**,
|
|
|
|
with the timestamp as content.
|
|
|
|
The directory ***/home/services/kvm-vm***, including all parent directories,
|
|
|
|
is only created on the host ***localhost***.
|
|
|
|
|
|
|
|
As you can see, there is no magic involved, the manifest is simple shell code that
|
|
|
|
utilises cdist types. Every available type can be executed like a normal
|
|
|
|
command. Use **ls conf/type** to get a list of available types. If you have
|
|
|
|
setup the MANPATH correctly as, you can use **man cdist-reference** to access
|
|
|
|
the reference with pointers to the manpages.
|
|
|
|
|
2012-01-16 17:11:28 +00:00
|
|
|
INITIAL VS. TYPE MANIFEST
|
|
|
|
-------------------------
|
2012-01-11 16:21:38 +00:00
|
|
|
|
2012-01-16 17:11:28 +00:00
|
|
|
MANAGING YOUR OWN CONFIGURATION
|
2011-02-26 19:41:33 +00:00
|
|
|
|
2011-03-23 16:16:43 +00:00
|
|
|
|
2011-02-26 19:41:33 +00:00
|
|
|
|
2012-01-16 17:11:28 +00:00
|
|
|
EXAMPLES
|
|
|
|
--------
|
2011-02-26 19:41:33 +00:00
|
|
|
The initial manifest may for instance contain the following code:
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
# Always create this file, so other sysadmins know cdist is used.
|
|
|
|
__file /etc/cdist-configured --type file
|
|
|
|
|
|
|
|
case "$__target_host" in
|
|
|
|
my.server.name)
|
|
|
|
__file /root/bin/ --type directory
|
|
|
|
__file /etc/issue.net --type file --source "$__manifest/issue.net
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
The manifest of the type "nologin" may look like this:
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
__file /etc/nologin --type file --source "$__type/files/default.nologin"
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2011-03-18 01:01:37 +00:00
|
|
|
DEPENDENCIES
|
|
|
|
------------
|
|
|
|
If you want to describe that something requires something else, just
|
|
|
|
setup the variable "require" to contain the requirements. Multiple
|
|
|
|
requirements can be added white space seperated.
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
# No dependency
|
|
|
|
__file /etc/cdist-configured
|
|
|
|
|
|
|
|
# Require above object
|
|
|
|
require="__file/etc/cdist-configured" __link /tmp/cdist-testfile \
|
|
|
|
--source /etc/cdist-configured --type symbolic
|
|
|
|
|
|
|
|
# Require two objects
|
|
|
|
require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \
|
|
|
|
__file /tmp/cdist-another-testfile
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2012-01-16 17:11:28 +00:00
|
|
|
If you do not specify
|
|
|
|
|
|
|
|
FIXME: autorequire
|
2011-02-26 19:41:33 +00:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2011-03-09 20:54:13 +00:00
|
|
|
- cdist-type(7)
|
2012-01-16 17:11:28 +00:00
|
|
|
- cdist-tutorial(7)
|
2011-02-26 19:41:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
COPYING
|
|
|
|
-------
|
2012-01-11 16:21:38 +00:00
|
|
|
Copyright \(C) 2010-2012 Nico Schottelius. Free use of this software is
|
2011-02-26 19:41:33 +00:00
|
|
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|