Merge branch 'master' of git://git.schottelius.org/cdist

This commit is contained in:
Daniel Roth 2011-03-10 18:01:41 +01:00
commit 36cfc8907d
27 changed files with 540 additions and 270 deletions

View file

@ -9,16 +9,20 @@ WEBDIR=$$HOME/niconetz
WEBPAGE=software/cdist.mdwn WEBPAGE=software/cdist.mdwn
MANDIR=doc/man MANDIR=doc/man
# Unchecked
MANSRC=$(MANDIR)/cdist-config-layout.text \ MANSRC=$(MANDIR)/cdist-config-layout.text \
$(MANDIR)/cdist-config.text \ $(MANDIR)/cdist-config.text \
$(MANDIR)/cdist-explorer.text \
$(MANDIR)/cdist-quickstart.text \ $(MANDIR)/cdist-quickstart.text \
$(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-terms.text \ $(MANDIR)/cdist-terms.text \
# Clean documentation
MANGENERATED=$(MANDIR)/cdist-reference.text
MANSRC=$(MANDIR)/cdist.text \ MANSRC=$(MANDIR)/cdist.text \
$(MANDIR)/cdist-bin-transfer.text \ $(MANDIR)/cdist-bin-transfer.text \
$(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-deploy-to.text \
$(MANDIR)/cdist-explorer.text \
$(MANDIR)/cdist-manifest.text \ $(MANDIR)/cdist-manifest.text \
$(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-type.text \ $(MANDIR)/cdist-type.text \
@ -42,13 +46,35 @@ all:
man: doc/man/.marker man: doc/man/.marker
doc/man/.marker: $(MANSRC) doc/man/.marker: $(MANDIR)/cdist-reference.text
for mansrc in $(MANSRC); do $(A2X) $$mansrc; done
for manpage in $(MANDIR)/*.[1-9]; do cat=$${manpage##*.}; mandir=$(MANDIR)/man$$cat; mkdir -p $$mandir; mv $$manpage $$mandir; done
touch $@ touch $@
# Manual from core
mancore: $(MANSRC)
for mansrc in $^; do $(A2X) $$mansrc; done
# Manuals from types
mantype:
for man in conf/type/*/man.text; do $(A2X) $$man; done
# Move into manpath directories
manmove: mantype mancore
for manpage in $(MANDIR)/*.[1-9] conf/type/*/*.7; do \
cat=$${manpage##*.}; \
mandir=$(MANDIR)/man$$cat; \
mkdir -p $$mandir; \
mv $$manpage $$mandir; \
done
# Reference depends on conf/type/*/man.text - HOWTO with posix make?
$(MANDIR)/cdist-reference.text: manmove $(MANDIR)/cdist-reference.text.sh
$(MANDIR)/cdist-reference.text.sh
$(A2X) $(MANDIR)/cdist-reference.text
# Move us to the destination as well
make manmove
clean: clean:
rm -rf doc/man/*.html doc/man/*.[1-9] doc/man/man[1-9] rm -rf doc/man/*.html doc/man/*.[1-9] doc/man/man[1-9] $(MANGENERATED)
################################################################################ ################################################################################
# Developer targets # Developer targets

View file

@ -79,6 +79,10 @@ To install cdist, execute the following commands:
cd cdist cd cdist
export PATH=$PATH:$(pwd -P)/bin export PATH=$PATH:$(pwd -P)/bin
# If you want the manpages
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
Afterwards you can run ***cdist-quickstart*** to get an impression on Afterwards you can run ***cdist-quickstart*** to get an impression on
how to use cdist. how to use cdist.
@ -105,6 +109,11 @@ To upgrade cdist in the current branch use
git pull git pull
# Also update the manpages
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
The version branches are designed to change if there are incompatibilities. The version branches are designed to change if there are incompatibilities.
Or the other way round: As long as you stay on 1.0 and do git pull, nothing Or the other way round: As long as you stay on 1.0 and do git pull, nothing
should break. should break.

View file

@ -57,13 +57,14 @@ __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
: ${__cdist_name_parameter:=parameter} : ${__cdist_name_parameter:=parameter}
: ${__cdist_name_parameter_required:=required} : ${__cdist_name_parameter_required:=required}
: ${__cdist_name_parameter_optional:=optional} : ${__cdist_name_parameter_optional:=optional}
: ${__cdist_name_singleton:=singleton}
: ${__cdist_name_target_host:=target_host} : ${__cdist_name_target_host:=target_host}
: ${__cdist_name_type:=type} : ${__cdist_name_type:=type}
: ${__cdist_name_type_bin:=type_bin} : ${__cdist_name_type_bin:=type_bin}
: ${__cdist_name_type_explorer:=type_explorer} : ${__cdist_name_type_explorer:=type_explorer}
# Used for IDs # Used for IDs: Allow everything not starting with - and .
: ${__cdist_sane_regexp:=[A-Za-z0-9/]*[-A-Za-z0-9_/]*} : ${__cdist_sane_regexp:=[^-\.].*}
# Default remote user # Default remote user
: ${__cdist_remote_user:=root} : ${__cdist_remote_user:=root}
@ -162,11 +163,6 @@ __cdist_init_deploy()
ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir" ln -sf "$__cdist_conf_dir" "$__cdist_local_base_dir/$__cdist_name_conf_dir"
} }
# __cdist_cache_host()
# {
# echo "${__cdist_cache_hosts}/${__cdist_target_host}"
# }
__cdist_type_has_explorer() __cdist_type_has_explorer()
{ {
# We only create output, if there's at least one explorer # We only create output, if there's at least one explorer
@ -196,14 +192,25 @@ __cdist_type_gencode()
echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}" echo "${__cdist_type_dir}/$1/${__cdist_name_gencode}"
} }
__cdist_type_singleton()
{
echo "${__cdist_type_dir}/$1/${__cdist_name_singleton}"
}
__cdist_type_parameter_dir() __cdist_type_parameter_dir()
{ {
echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}" echo "$(__cdist_type_dir "$1")/${__cdist_name_parameter}"
} }
__cdist_type_parameter_file() # Shorthand for required and optional
__cdist_type_parameter_required()
{ {
echo "$(__cdist_type_parameter_dir "$1")/$2" echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_required"
}
__cdist_type_parameter_optional()
{
echo "$(__cdist_type_parameter_dir "$1")/$__cdist_name_parameter_optional"
} }
__cdist_type_from_object() __cdist_type_from_object()

View file

@ -25,12 +25,18 @@
# #
. cdist-config . cdist-config
[ $# -ge 1 ] || __cdist_usage "<id> <options>"
set -eu set -eu
__cdist_object_id="$1"; shift
__cdist_type="$__cdist_myname" __cdist_type="$__cdist_myname"
# Find out whether type is a singleton or regular type
if [ -f "$(__cdist_type_singleton "$__cdist_type")" ]; then
__cdist_object_id="singleton"
else
[ $# -ge 1 ] || __cdist_usage "<id> <options>"
__cdist_object_id="$1"; shift
fi
echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || \ echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || \
__cdist_usage "Insane object id, ${__cdist_object_id}." __cdist_usage "Insane object id, ${__cdist_object_id}."
@ -72,20 +78,24 @@ while [ $# -gt 0 ]; do
done done
# Ensure required parameters are given # Ensure required parameters are given
while read required; do if [ -f "$(__cdist_type_parameter_required "$__cdist_type")" ]; then
while read required; do
if [ ! -f "${tempparameter}/${required}" ]; then if [ ! -f "${tempparameter}/${required}" ]; then
__cdist_usage "Missing required parameter $required" __cdist_usage "Missing required parameter $required"
fi fi
mv "${tempparameter}/${required}" "${__cdist_parameter_dir}" mv "${tempparameter}/${required}" "${__cdist_parameter_dir}"
done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_required")" done < "$(__cdist_type_parameter_required "$__cdist_type")"
fi
# Allow optional parameters # Allow optional parameters
while read optional; do if [ -f "$(__cdist_type_parameter_optional "$__cdist_type")" ]; then
while read optional; do
if [ -f "${tempparameter}/${optional}" ]; then if [ -f "${tempparameter}/${optional}" ]; then
mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}" mv "${tempparameter}/${optional}" "${__cdist_parameter_dir}"
fi fi
done < "$(__cdist_type_parameter_file "$__cdist_type" "$__cdist_name_parameter_optional")" done < "$(__cdist_type_parameter_optional "$__cdist_type")"
fi
# Error out on other paramaters # Error out on other paramaters
cd "${tempparameter}" cd "${tempparameter}"

View file

@ -3,32 +3,50 @@
# #
# This is debug and should not be in a production environment # This is debug and should not be in a production environment
echo "We could access other manifests in $__manifest" # echo "We could access other manifests in $__manifest"
# Every machine becomes a marker, so sysadmins know that automatic
# configurations are happening
__file /etc/cdist-configured --type file __file /etc/cdist-configured --type file
case "$__target_host" in case "$__target_host" in
# Everybody has this # Everybody has this
localhost) localhost)
# Usual example
__file test --type file --destination /tmp/cdist-testfile __file test --type file --destination /tmp/cdist-testfile
;; ;;
#
# Examples using different types
#
# Alias in /etc/hosts for localhost # Alias in /etc/hosts for localhost
cdist-archlinux) cdist-archlinux)
__package_pacman django --state deinstalled # This is the specific package type for pacman
__package_pacman wireshark-cli --state installed
__package_pacman zsh --state installed __package_pacman zsh --state installed
# The __package type autoselect the right type based on the os
__package vim --state installed
# If the type is a singleton, it does not take an object id
__issue
;; ;;
# This is how it would look like on gentoo
cdist-gentoo) cdist-gentoo)
# Same stuff for gentoo
__package tree --state installed __package tree --state installed
;; ;;
cdist-debian)
__package_apt atop --state installed
__package apache2 --state deinstalled
;;
# Real machines # Real machines may be used with their hostname or fqdn,
ikq*) # depending on how you call cdist-deploy-to
__package_apt zsh --state installed # machine)
__package_apt apache2 --state deinstalled # ...
;; # ;;
kr) # machine.example.org)
__issue iddoesnotmatterhere # ...
;; # ;;
esac esac

View file

@ -0,0 +1,34 @@
#!/bin/sh
#
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
#
# 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/>.
#
#
# Check whether file exists or not
#
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id"
fi
if [ -e "$destination" ]; then
echo yes
else
echo no
fi

View file

@ -41,7 +41,11 @@ esac
# No output if file does not exist - does definitely not match the md5sum :-) # No output if file does not exist - does definitely not match the md5sum :-)
if [ -e "$destination" ]; then if [ -e "$destination" ]; then
if [ -f "$destination" ]; then
$md5sum < "$destination" $md5sum < "$destination"
else
echo "NO REGULAR FILE"
fi
else else
echo "NO FILE FOUND, NO CHECKSUM CALCULATED." echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
fi fi

View file

@ -55,6 +55,7 @@ esac
if [ -f "$__object/parameter/source" ]; then if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")" source="$(cat "$__object/parameter/source")"
if [ -f "$source" ]; then
local_md5sum="$($md5sum < "$source")" local_md5sum="$($md5sum < "$source")"
remote_md5sum="$(cat "$__object/explorer/md5sum")" remote_md5sum="$(cat "$__object/explorer/md5sum")"
@ -66,8 +67,11 @@ if [ -f "$__object/parameter/source" ]; then
# Probably describe it in cdist-quickstart... # Probably describe it in cdist-quickstart...
scp "$source" "root@${__target_host}:${destination}" scp "$source" "root@${__target_host}:${destination}"
fi fi
fi
# No source? Create empty file/dir # No source? Create empty file/dir
else else
# Only touch / create if it does not exist
if [ no = "$(cat "$__object/explorer/exists")" ]; then
case "$type" in case "$type" in
directory) directory)
echo mkdir \"$destination\" echo mkdir \"$destination\"
@ -82,6 +86,7 @@ else
exit 1 exit 1
;; ;;
esac esac
fi
fi fi
if [ -f "$__object/parameter/mode" ]; then if [ -f "$__object/parameter/mode" ]; then

59
conf/type/__file/man.text Normal file
View file

@ -0,0 +1,59 @@
cdist-type__file(7)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__file - Create files
DESCRIPTION
-----------
This cdist type allows you to create files on the target.
REQUIRED PARAMETERS
-------------------
type::
Specifies the type of file to be created. Either "directory" or "file"
OPTIONAL PARAMETERS
-------------------
destination::
If supplied, use this as the destination on the target. Otherwise the
object_id is used.
mode::
Unix permissions, suitable for chmod.
source::
If supplied, copy this file from the host running cdist to the target.
If not supplied, an empty file or directory will be created.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Create /etc/cdist-configured as an empty file
__file /etc/cdist-configured --type file
# Same but with a different object id
__file cdist-marker --type file --destination /etc/cdist-configured
# Use __file from another type
__file /etc/issue --source "$__type/files/archlinux" --type file
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -20,7 +20,7 @@
# #
destination=/etc/issue destination=/etc/issue
os="$(cat "out/explorer/os")" source="$(cat "out/explorer/os")"
case "$os" in case "$os" in
archlinux) archlinux)

View file

View file

@ -29,7 +29,7 @@ fi
state="$(cat "$__object/parameter/state")" state="$(cat "$__object/parameter/state")"
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")" is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)"
case "$state" in case "$state" in
installed) installed)

View file

@ -1,5 +1,10 @@
1.0.2: upcoming 1.0.3: upcoming
* Add manpages: cdist-type * Update regexp used for sane characters
* Allow types without parameters
* Allow type to be singleton (DOCUMENTATION MISSING)
1.0.2: 2011-03-09
* Add manpages: cdist-type, cdist-type__file, cdist-reference, cdist-explorer
* Make doc/man/ usable as MANPATH entry * Make doc/man/ usable as MANPATH entry
1.0.1: 2011-03-08 1.0.1: 2011-03-08

3
doc/dev/logs/2011-03-09 Normal file
View file

@ -0,0 +1,3 @@
Steven & Nico:
- types are closed in themselves
- manpage will be stored in conf/type/NAME/man.text

View file

@ -1,4 +1,3 @@
Documentation cleanup - Support singletons (see types/issue for a good reason)
- document environment variables - add documentation!
- Reference all types somewhere (on the webpage?)
- how to debug explorer

View file

@ -1,9 +1,3 @@
Core:
- Support singletons (see types/issue for a good reason)
- probably name them only_once and use that as the internal id!
- cdist-deploy-to: Configure more than one host
- plus parallel mode like in ccollect
Type handler: Type handler:
- add dependency parameters to core available for every type - add dependency parameters to core available for every type
--requires --requires
@ -36,8 +30,6 @@ Documentation:
- cdist-trigger after first run from /var/lib/cdist/out/bin? - cdist-trigger after first run from /var/lib/cdist/out/bin?
- Different environments (production, integration, development) - Different environments (production, integration, development)
- via version control - via version control
- Define how to raise errors in types
- Check all references in manpages, ensure all manpages exist, generic ones: - Check all references in manpages, ensure all manpages exist, generic ones:
+ cdist + cdist
+ cdist-deploy-to + cdist-deploy-to
@ -47,10 +39,6 @@ Documentation:
- install packages only if not existent - install packages only if not existent
- copy file only if different - copy file only if different
- DOC document that $type/manifest is executed for every object/instance - DOC document that $type/manifest is executed for every object/instance
- category 7:
- cdist-manifest(7)
- cdist-explorer
- cdist-config-layout
- ensure every file in bin/ has a correspondent manpage - ensure every file in bin/ has a correspondent manpage
- cdist-code-run-all - cdist-code-run-all
- cdist-config - cdist-config
@ -69,8 +57,10 @@ Documentation:
- cdist-run-remote - cdist-run-remote
- cdist-type-build-emulation - cdist-type-build-emulation
- cdist-type-emulator - cdist-type-emulator
- Cleanup READMEs
- Ensure html output of manpages are published on the web - Ensure html output of manpages are published on the web
--------------------------------------------------------------------------------
Fix:
Running initial manifest for sgv-wiki-01 ...
/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 87: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/required: Datei oder Verzeichnis nicht gefunden
/tmp/cdist.VfhjaH8LP3GE/out/type_bin/__ethz_systems_wiki: Zeile 94: /home/users/nico/privat/firmen/ethz/vcs/cdist/conf/type/__ethz_systems_wiki/parameter/optional: Datei oder Verzeichnis nicht gefunden
- Makefile:
- Include manpage generation

1
doc/man/.gitignore vendored
View file

@ -1,3 +1,4 @@
cdist.7 cdist.7
*.html *.html
cdist-design.7 cdist-design.7
cdist-reference.text

View file

@ -30,10 +30,10 @@ variables are handled by cdist-config.
SEE ALSO SEE ALSO
-------- --------
cdist(7), - cdist(7)
cdist-config(1), - cdist-config(1)
cdist-config-layout(7), - cdist-reference(7)
cdist-stages(7) - cdist-stages(7)
COPYING COPYING

View file

@ -0,0 +1,68 @@
cdist-explorer(7)
=================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-explorer - Explore the target systems
DESCRIPTION
-----------
Explorer are small shell scripts, which will be executed on the target
host. The aim of the explorer is to give hints to types on how to act on the
target system. An explorer outputs the result to stdout, which is usually
a one liner, but may be empty or multi line especially in the case of
type explorers.
There are general explorers, which are run in an early stage, and
type explorers. Both work almost exactly the same way, with the difference
that the values of the general explorers are stored in a general location and
the type specific below the object.
Explorers can reuse other explorers on the target system by calling
$__explorer/<explorer_name> (general and type explorer) or
$__type_explorer/<explorer name> (type explorer).
In case of significant errors, the explorer may exit non-zero and return an
error message on stderr, which will cause the cdist run to abort.
You can also use stderr for debugging purposes while developing a new
explorer.
EXAMPLES
--------
A very simple explorer may look like this:
--------------------------------------------------------------------------------
hostname
--------------------------------------------------------------------------------
Which is in practise the "hostname" explorer.
A type explorer, which could check for the status of a package may look like this:
--------------------------------------------------------------------------------
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
# Except dpkg failing, if package is not known / installed
dpkg -s "$name" 2>/dev/null || exit 0
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist(7)
- cdist-reference(7)
- cdist-stages(7)
COPYING
-------
Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -43,10 +43,10 @@ __file /etc/nologin --type file --source "$__type/files/default.nologin"
SEE ALSO SEE ALSO
-------- --------
cdist-manifest-run(1), - cdist-manifest-run(1)
cdist-manifest-run-all(1), - cdist-manifest-run-all(1)
cdist-manifest-run-init(1), - cdist-manifest-run-init(1)
cdist-type(7) - cdist-type(7)
COPYING COPYING

195
doc/man/cdist-reference.text.sh Executable file
View file

@ -0,0 +1,195 @@
#!/bin/sh
#
# 2010-2011 Nico Schottelius (nico-cdist at schottelius.org)
#
# 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}"
dest="$__cdist_abs_mydir/$filename"
cd "$__cdist_abs_mydir"
exec > "$dest"
cat << eof
cdist-reference(7)
==================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-reference - Variable, path and type reference for cdist $(git describe)
DESCRIPTION
-----------
Various scripts which are not in the core need information on how
to find information. This manpage summarises the available environment
variables, types and paths and clearifies with part may access which variables.
PATHS
-----
If not specified otherwise, all paths are relative to the checkout directory.
conf/::
Contains the (static) configuration like manifests, types and explorers.
conf/manifest/init::
This is the central entry point used by cdist-manifest-init(1).
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.
It should be primary used to define mapping from configurations to hosts.
conf/manifest/*::
All other files in this directory are not directly used by cdist, but you
can seperate configuration mappings, if you have a lot of code in the
manifest/init file. This may also be very helpful to have different admins
maintain different groups of hosts.
conf/explorer/<name>::
Contains explorers to be run on the target hosts, see cdist-explorer(7).
conf/type/::
Contains all available types, which are used to provide
some kind of functionality. See cdist-type(7).
conf/type/<name>/::
Home of the type <name>.
This directory is referenced by the variable __type (see below).
conf/type/<name>/man.text::
Manpage in Asciidoc format (nequired for inclusion into upstream)
conf/type/<name>/manifest::
Used to generate additional objects from a type.
conf/type/<name>/gencode::
Used to generate code to be executed on the client.
conf/type/<name>/parameters/required::
Parameters required by type, \n seperated list.
conf/type/<name>/parameters/optional::
Parameters optionally accepted by type, \n seperated list.
conf/type/<name>/explorer::
Location of the type specific explorers.
This directory is referenced by the variable __type_explorer (see below).
See cdist-explorer(7).
out/::
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).
out/explorer::
Output of general explorers.
out/object::
Objects created for the host.
out/object/<object>::
Contains all object specific information.
This directory is referenced by the variable __object (see below).
out/object/<object>/explorers::
Output of type specific explorers, per object.
tmp_dir::
A tempdir and a tempfile is used by cdist internally,
which will be removed when the scripts end automatically.
See cdist-config(1).
TYPES
-----
The following types are available:
eof
for type in man7/cdist-type__*; do
name_1="${type#man7/cdist-type}"
name_2="${name_1%.7}"
name="$name_2"
echo "- $name"
done
cat << eof
VARIABLES
---------
__explorer::
Directory that contains all explorers.
Available for: explorer
__manifest::
Directory that contains the initial manifest.
Available for: initial manifest
__global::
Directory that contains generic output like explorer.
Available for: initial manifest, type manifest, type explorer, type codegen
__object::
Directory that contains the current object.
Available for: type manifest, type explorer, type codegen
__object_id::
The type unique object id.
Available for: type manifest, type explorer, type codegen
__target_host::
The host we are deploying to.
Available for: initial manifest, type manifest, type codegen
__type::
Path to the current type.
Available for: type manifest
__type_explorers::
Directory that contains the type explorers.
Available for: type explorer
SEE ALSO
--------
- cdist(7)
eof
for type in man7/cdist-type__*; do
name_1="${type#man7/}"
name_2="${name_1%.7}"
name="$name_2"
echo "- ${name}(7)"
done
cat <<eof
COPYING
-------
Copyright \(C) 2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).
eof

View file

@ -46,10 +46,9 @@ no conflicts may occur, i.e. no object of the same type with the same id may
be created. be created.
Related manpages: Related manpages:
- cdist-manifest(7)
- cdist-manifest-run(1) - cdist-manifest-run(1)
- cdist-manifest-run-init(1) - cdist-manifest-run-init(1)
- cdist-manifest(7)
- cdist-config-layout(7)
STAGE 3: EXECUTION OF TYPES STAGE 3: EXECUTION OF TYPES
@ -67,9 +66,9 @@ may occur during the merge. A conflict would mean that two different objects
try to create the same object, which indicates a broken configuration. try to create the same object, which indicates a broken configuration.
Related manpages: Related manpages:
- cdist-type(7)
- cdist-manifest-run(1) - cdist-manifest-run(1)
- cdist-manifest-run-all(1) - cdist-manifest-run-all(1)
- cdist-type(7)
STAGE 4: CODE GENERATION STAGE 4: CODE GENERATION
@ -81,9 +80,9 @@ on stdout. If the gencode executable fails, it must print diagnostic messages
on stderr and exit non-zero. on stderr and exit non-zero.
Related manpages: Related manpages:
- cdist-types-gencode(7)
- cdist-gencode(1) - cdist-gencode(1)
- cdist-gencode-all(1) - cdist-gencode-all(1)
- cdist-type(7)
STAGE 5: CODE EXECUTION STAGE 5: CODE EXECUTION
@ -92,8 +91,8 @@ The resulting code from the previous stage is transferred to the target host
and executed there to apply the configuration changes, and executed there to apply the configuration changes,
Related manpages: Related manpages:
- cdist-exec-transfer(1)
- cdist-exec-run(1) - cdist-exec-run(1)
- cdist-exec-transfer(1)
SUMMARY SUMMARY
@ -106,7 +105,9 @@ in correct order.
SEE ALSO SEE ALSO
-------- --------
cdist(7), cdist-deploy-to(1), cdist-config-layout(7) - cdist(7)
- cdist-deploy-to(1)
- cdist-reference(7)
COPYING COPYING

View file

@ -37,6 +37,8 @@ Internally cdist-type-emulator(1) will be called from cdist-manifest-run(1) to
save the given parameters into a cconfig database, so they can be accessed by save the given parameters into a cconfig database, so they can be accessed by
the manifest and gencode scripts of the type (see below). the manifest and gencode scripts of the type (see below).
A list of supported types can be found in the cdist-type-listing(7) manpage.
HOW TO WRITE A NEW TYPE HOW TO WRITE A NEW TYPE
----------------------- -----------------------
@ -151,8 +153,8 @@ If you think your type may be useful for others, ensure it works with the
current master branch of cdist and submit the git url containing the type for current master branch of cdist and submit the git url containing the type for
inclusion to the mailinglist **cdist at cdist -- at -- l.schottelius.org**. inclusion to the mailinglist **cdist at cdist -- at -- l.schottelius.org**.
Ensure a corresponding manpage named cdist-type-NAME (without Ensure a corresponding manpage named man.text in asciidoc format with
underscores) is included. the manpage-name "cdist-type__NAME" is included in the type directory.
SEE ALSO SEE ALSO

View file

@ -29,12 +29,11 @@ pull mechanism (client requests configuration).
SEE ALSO SEE ALSO
-------- --------
Website: http://www.nico.schottelius.org/cdist/[], - Website: http://www.nico.schottelius.org/cdist/[]
cdist-deploy-to(1), - cdist-deploy-to(1)
cdist-manifest(7), - cdist-manifest(7)
cdist-quickstart(1), - cdist-quickstart(1)
cdist-type(7), - cdist-type(7)
cdist-type-inclusion(7)
COPYING COPYING

View file

@ -1,108 +0,0 @@
cdist-config-layout(7)
======================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-config-layout - Usage of paths in cdist
DESCRIPTION
-----------
If not specified otherwise, all paths are relative to the configuration
directory, which is normally /etc/cdist (but can be changed using environment
variables, see cdist-environment(7)).
- conf_dir/:
Contains the (static) configuration like manifests, types and
explorers.
- conf_dir/manifest/init:
This is the central entry point used by cdist-manifest-init(1).
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.
It should be primary used to define mapping from configurations to hosts.
- conf_dir/manifest/*:
All other files in this directory are not directly used by Cdist, but you
can seperate configuration mappings, if you have a lot of code in the
manifest/init file. This may also be very helpful to have different admins
maintain different groups of hosts.
- conf_dir/explorer/<name>
Contains explorers to be run on the target hosts, see cdist-explorers(7).
- conf_dir/type/
Contains all available types, which are used to provide
some kind of functionality. See cdist-stages(7).
- conf_dir/type/<name>/manifest:
Used to generate additional objects from a type.
See cdist-stages(7), cdist-types(7).
- conf_dir/type/<name>/gencode:
Used to generate code to be executed on the client.
See cdist-types(7).
- conf_dir/type/<name>/parameters/required:
Parameters required by type, \n seperated list.
See cdist-types(7).
- conf_dir/type/<name>/parameters/optional:
Parameters optionally accepted by type, \n seperated list.
See cdist-types(7).
- conf_dir/type/<name>/explorer:
Location of the type specific explorers.
See cdist-explorers(7).
- out_dir/
This directory contains output of cdist and is mirrored into the
cache after a successful run. This directory may be placed below
the tmpdir or at any other location and is also available on the
target.
- out_dir/explorer:
Output of general explorers.
- out_dir/object:
Objects created for the host.
- out_dir/object/<object>/explorers:
Output of type specific explorers, per object.
- tmp_dir: Temporary storage
A tempdir and a tempfile is provided by cdist-config(1), which
will be removed when the scripts ends automatically.
FUTURE
------
The following functionality may be implemented in one of the next releases:
- cache_dir/
The cache contains the out_dir from previous runs, which
may also be used in types to gather information about other hosts
(like ssh-keys).
- cache_dir/host/<name>:
Contains the last out_dir of the specific host.
AUTHOR
------
Nico Schottelius <mailto:nico-cdist--@--schottelius.org[]>
RESOURCES
---------
Main web site: http://www.nico.schottelius.org/cdist/[]
COPYING
-------
Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -1,14 +0,0 @@
Update on env:
general explorer: __explorer
initial manifest: __manifest, __global
type manifests __object, __object_id, __global
type explorers: __object, __object_id, __type_explorers, __global
type codegen: __object, __object_id, __global
type code: -
- __object: Path to the object that we are working on
- __object_id: type unique object id
- __global: contains global information (see cdist-env

View file

@ -1,43 +0,0 @@
cdist-explorer(7)
=================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-explorer - Explore the target systems
DESCRIPTION
-----------
Cdist explorer are small shell scripts, which will be executed
on the target host. The aim of the explorer is to give hints
to types on how to act on the target system.
The explorer output the result of its investigation
to stdout and should be a one-liner. The output may be empty,
though.
Cdist knows about general explorers, which are run in an early
stage and type specific explorers. Both work exactly the same way,
with the difference that the values of the general explorers
are stored in a general location and the type specific below
the types.
Explorers can reuse other explorers on the target system
by calling ./<explorer_name> (i.e. explorers are run
from their location).
In case of significant errors, the shell script may exit
non-zero and return an error message on stderr, which
will cause the cdist run to abort.
SEE ALSO
--------
cdist(7), cdist-config-layout(7), cdist-stages(7)
COPYING
-------
Copyright \(C) 2010-2011 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).