cdist/doc/man/man7/cdist-tutorial.text

124 lines
3.3 KiB
Text
Raw Normal View History

cdist-tutorial(7)
=================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-tutorial - a guided introduction into cdist
INTRODUCTION
------------
This document gives you a pointer on what to read in
which order and is thus more a "guide to the right locations".
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.
PARTS BELOW HERE ARE TO-BE-DONE
-> ssh stuff double: cdist-best-practice and here
CONTINUE READING
----------------
So far you have seen how to get cdist up and running and
how the initial manifest is being used.
own branch => very early [before first change?]
=> no, first quick intro, then do it right
It is recommended to
- MANAGING YOUR OWN CONFIGURATION
- write own type
MANAGING YOUR OWN CONFIGURATION
-------------------------------
CREATING YOUR FIRST OWN TYPE
----------------------------
=> short example, reference to cdist-type(7)!
=> motivation
Use a type to bundle functionalitY
<with object id? or signleton here already>
Debug with var - can be used by yourself
__debug::
If this variable is setup, cdist runs in debug mode.
You can use this information, to only output stuff in debug
mode as well.
Available for: initial manifest, type manifest, gencode, code
USING EXPLORERS
---------------
cdist-explorer.text
DEBUGGING YOUR TYPES
--------------------
TUNING CDIST
------------
- speedup processing with ControlMaster option of
ssh
=> different document
SEE ALSO
--------
- cdist(1)
- cdist-type(7)
- cdist-best-practice(7)
- cdist-stages(7)?
COPYING
-------
Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).