fix merge conflict in changelog

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-03-16 14:41:43 +01:00
commit 59e774b08d
43 changed files with 916 additions and 480 deletions

View file

@ -8,22 +8,19 @@ A2X=a2x -f manpage --no-xmllint
WEBDIR=$$HOME/niconetz WEBDIR=$$HOME/niconetz
WEBPAGE=software/cdist.mdwn WEBPAGE=software/cdist.mdwn
# Documentation
MANDIR=doc/man MANDIR=doc/man
# Unchecked
MANSRC=$(MANDIR)/cdist-config-layout.text \
$(MANDIR)/cdist-config.text \
$(MANDIR)/cdist-quickstart.text \
$(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-terms.text \
# Clean documentation
MANGENERATED=$(MANDIR)/cdist-reference.text 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-config.text \
$(MANDIR)/cdist-dir.text \
$(MANDIR)/cdist-env.text \
$(MANDIR)/cdist-deploy-to.text \ $(MANDIR)/cdist-deploy-to.text \
$(MANDIR)/cdist-explorer.text \ $(MANDIR)/cdist-explorer.text \
$(MANDIR)/cdist-manifest.text \ $(MANDIR)/cdist-manifest.text \
$(MANDIR)/cdist-quickstart.text \
$(MANDIR)/cdist-stages.text \ $(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-type.text \ $(MANDIR)/cdist-type.text \
$(MANDIR)/cdist-type-template.text \ $(MANDIR)/cdist-type-template.text \
@ -39,7 +36,7 @@ all:
@echo '' @echo ''
@echo 'Here are the possible targets:' @echo 'Here are the possible targets:'
@echo '' @echo ''
@echo ' man: Build manpages' @echo ' man: Build manpages (requires Asciidoc (a2x binary))'
@echo ' clean: Remove build stuff' @echo ' clean: Remove build stuff'
@echo '' @echo ''
@echo '' @echo ''
@ -89,9 +86,10 @@ test:
.rsync nicosc@ru3.inf.ethz.ch:cdist .rsync nicosc@ru3.inf.ethz.ch:cdist
web: web:
cp REAL_README $(WEBDIR)/$(WEBPAGE) cp README $(WEBDIR)/$(WEBPAGE)
cd $(WEBDIR) && git commit -m "cdist update" $(WEBPAGE) cd $(WEBDIR) && git commit -m "cdist update" $(WEBPAGE)
cd $(WEBDIR) && make pub cd $(WEBDIR) && make pub
pub: pub:
git push --mirror git push --mirror
git push --mirror github

1
README
View file

@ -1 +0,0 @@
REAL_README

198
README Normal file
View file

@ -0,0 +1,198 @@
[[!meta title="cdist - configuration management"]]
.. . .x+=:. s
dF @88> z` ^% :8
'88bu. %8P . <k .88
. '*88888bu . .@8Ned8" :888ooo
.udR88N ^"*8888N .@88u .@^%8888" -*8888888
<888'888k beWE "888L ''888E` x88: `)8b. 8888
9888 'Y" 888E 888E 888E 8888N=*8888 8888
9888 888E 888E 888E %8" R88 8888
9888 888E 888F 888E @8Wou 9% .8888Lu=
?8888u../ .888N..888 888& .888888P` ^%888*
"8888P' `"888*"" R888" ` ^"F 'Y"
"P' "" ""
[[!toc levels=2]]
## Introduction
cdist configures your system and is similar to
other configuration management systems like
[cfengine](http://www.cfengine.org/),
[bcfg2](http://trac.mcs.anl.gov/projects/bcfg2),
[chef](http://wiki.opscode.com/display/chef/)
and [puppet](http://www.puppetlabs.com/), but
it ticks differently:
* cdist sticks completly to the KISS (keep it simple and stupid) paradigma
* cdist's core is very small (< 1k lines of code)
* There is only one type to extend cdist called ***type***.
* One main development target: ***It must be incredible easy to add new types.***
* cdist is UNIX
* It reuses existing tools like cat, find, mv, ...
* cdist's documentation is bundled as manpages
* cdist is written in POSIX shell
* No special requirements like high level interpreters needed on server or target
### Architecture
* Push mode (server pushes configuration)
* User defines configuration in shell scripts (called ***manifests***)
* Generates internal configuration (cconfig style)
* Uses ***types*** to generate code be executed on the target
* And finally executes the code on the target / applies the configuration
### Features
Stuff that should probably be included in every configuration management,
but is not. Or: Why I began to write cdist:
* Speed
* Elegant code
* Clean design
* Good documentation (man pages)
* Meaningful error messages
* The no surprise factor
* Consistency in behaviour, naming and documentation
* Easy integration into bare metal installations
* Simple and well-known DSL: posix shell
* It must be very easy to extend and debug cdist
* Focus on reuse of existing functionality (like sh, ssh, find, rm, ...)
* Easy upgrade: ***There is no need to update cdist on target hosts!***
* cdist only needs to be update on the master server
### OS support
cdist was tested or is know to run on at least
* [Archlinux](http://www.archlinux.org/)
* [Debian](http://www.debian.org/)
* [Gentoo](http://www.gentoo.org/)
* [Mac OS X](http://www.apple.com/macosx/)
* [Redhat](http://www.redhat.com/)
* [Ubuntu](http://www.ubuntu.com/)
## Requirements
### Server
* A posix like shell
* SSH-Client
### Client ("target host")
* A posix like shell
* SSH-Server
## Getting cdist
You can clone cdist from git, which gives you the advantage of having
a version control in place for development of your own stuff as well.
### Installation
To install cdist, execute the following commands:
git clone git://git.schottelius.org/cdist
cd cdist
export PATH=$PATH:$(pwd -P)/bin
# If you want the manpages (requires asciidoc to be installed)
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
Afterwards you can run ***cdist-quickstart*** to get an impression on
how to use cdist.
### Available versions
There are at least the following branches available:
* master: the development branch
* 1.0: First official release
* 1.1: Current stable (includes \_\_file type change)
Other branches may be available for features or bugfixes, but they
may vanish at any point. To select a specific branch use
# Generic code
git checkout -b <name> origin/<name>
# Stay on version 1.1
git checkout -b 1.1 origin/1.1
### Mirrors
* git://github.com/telmich/cdist.git ([github](https://github.com/telmich/cdist))
* git://git.sans.ethz.ch/cdist ([sans](http://git.sans.ethz.ch/?p=cdist;a=summary))
## Update
To upgrade cdist in the current branch use
git pull
# Also update the manpages
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
If you stay on a version branche (i.e. 1.0, 1.1., ...), nothing should break.
The master branch on the other hand is the development branch and may not be
working, break your setup or eat the tree in your garden.
### Upgrading from 1.0 to 1.1
In 1.1 the type **\_\_file** was split into **\_\_directory**, **\_\_file** and
**\_\_link**. The parameter **--type** was removed from **\_\_file**. Thus you
need to replace **\_\_file** calls in your manifests:
* Remove --type from all \_\_file calls
* If type was symlink, use \_\_link and --type symbolic
* If type was directory, use \_\_directory
## Support
### IRC
You can join the development ***IRC channel***
[#cLinux on irc.freenode.org](irc://irc.freenode.org/#cLinux).
### Mailing list
Bug reports, questions, patches, etc. should be send to the
[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist).
## Used by
If you're using cdist, feel free to send a report to the mailing list.
Interesting information are for instance
* Which services do you manage?
* How many machines do you manage?
* What are the pros/cons you see in cdist?
* General comments/critics
### Nico Schottelius, Systems Group ETH Zurich
Yes, I'm actually eating my own dogfood and currently managing
* [plone](http://plone.org/) (cms)
* [moinmoin](http://moinmo.in/) (wiki)
* [apache](http://httpd.apache.org/) (webserver)
* [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication)
* [ircd-hybrid](http://www.ircd-hybrid.org/) (chat)
* [stunnel](http://stunnel.mirt.net/) (SSL tunnel)
* [mercurial-server](http://www.lshift.net/mercurial-server.html) (version control)
* [xfce](http://www.xfce.org/) (lightweight desktop environment)
* [slim](http://slim.berlios.de/) (graphical login manager for X11)
with cdist on a total of **5** production machines of the
[Systems Group](http://www.systems.ethz.ch) at the
[ETH Zurich](http://www.ethz.ch).

View file

@ -1,171 +0,0 @@
[[!meta title="cdist - configuration management"]]
.. . .x+=:. s
dF @88> z` ^% :8
'88bu. %8P . <k .88
. '*88888bu . .@8Ned8" :888ooo
.udR88N ^"*8888N .@88u .@^%8888" -*8888888
<888'888k beWE "888L ''888E` x88: `)8b. 8888
9888 'Y" 888E 888E 888E 8888N=*8888 8888
9888 888E 888E 888E %8" R88 8888
9888 888E 888F 888E @8Wou 9% .8888Lu=
?8888u../ .888N..888 888& .888888P` ^%888*
"8888P' `"888*"" R888" ` ^"F 'Y"
"P' "" ""
[[!toc levels=2]]
## Introduction
cdist configures your system and is similar to
other configuration management systems like
[cfengine](http://www.cfengine.org/),
[bcfg2](http://trac.mcs.anl.gov/projects/bcfg2),
[chef](http://wiki.opscode.com/display/chef/)
and [puppet](http://www.puppetlabs.com/), but
it ticks differently:
* cdist sticks completly to the KISS (keep it simple and stupid) paradigma
* cdist's core is very small (< 1k lines of code)
* There is only one type to extend cdist called ***type***.
* One main development target: ***It must be incredible easy to add new types.***
* cdist is UNIX
* It reuses existing tools like cat, find, mv, ...
* cdist's documentation is bundled as manpages
* cdist is written in POSIX shell
* No special requirements like high level interpreters needed on server or target
### Architecture
* Push mode (server pushes configuration)
* Pull mode planned (client triggers configuration)
* User defines configuration in shell scripts (called ***manifests***)
* Generates internal configuration (cconfig style)
* Uses ***types*** to generate code be executed on the target
* And finally executes the code on the target / applies the configuration
### Features
Stuff that should probably be included in every configuration management,
but is not. Or: The reason why I began to write cdist.
* Speed
* Elegant code
* Clean design
* Good documentation (man pages)
* Meaningful error messages
* No surprise factor
* Consistency in behaviour, naming and documentation
* Easy integration nacked installations
* Simple and well-known DSL: posix shell
* It is very easy to
* extend cdist
* debug cdist-core and cdist-types
* Focus on reuse of existing functionality
* ssh
* sh
* find, rm, ...
## Requirements
### Server
* A posix like shell
* SSH-Client
### Client ("target host")
* A posix like shell
* SSH-Server
## Getting cdist
You can clone cdist from git, which gives you the advantage of having
a version control in place for development of your own stuff as well.
### Installation
To install cdist, execute the following commands:
git clone git://git.schottelius.org/cdist
cd cdist
export PATH=$PATH:$(pwd -P)/bin
# If you want the manpages (requires asciidoc to be installed)
make man
export MANPATH=$MANPATH:$(pwd -P)/doc/man
Afterwards you can run ***cdist-quickstart*** to get an impression on
how to use cdist.
### Available versions
There are at least two branches available:
* master: the development branch
* 1.0: stable branch of version 1.0
Other branches may be available as well for features or bugfixes, but they
may vanish at any point. To select a specific branch use
# Generic code
git checkout -b <name> origin/<name>
# Stay on version 1.0
git checkout -b 1.0 origin/1.0
### Update
To upgrade cdist in the current branch use
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.
Or the other way round: As long as you stay on 1.0 and do git pull, nothing
should break.
## Support
### IRC
You can join the development ***IRC channel***
[#cLinux on irc.freenode.org](irc://irc.freenode.org/#cLinux).
### Mailing list
Bug reports, questions, patches, etc. should be send to the
[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist).
## Used by
If you're using cdist, feel free to send a report to the mailing list.
Interesting information are for instance
* Which services do you manage?
* How many machines do you manage?
* What are the pros/cons you see in cdist?
* General comments/critics
### Nico Schottelius, Systems Group ETH Zurich
Yes, I'm actually eating my own dogfood and currently managing
* [plone](http://plone.org/) (cms)
* [moinmoin](http://moinmo.in/) (wiki)
* [apache](http://httpd.apache.org/) (webserver)
* [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication)
* [ircd-hybrid](http://www.ircd-hybrid.org/) (chat)
* [stunnel](http://stunnel.mirt.net/) (SSL tunnel)
with cdist on a total of **3** production servers of the
[Systems Group](http://www.systems.ethz.ch) at the
[ETH Zurich](http://www.ethz.ch).

View file

@ -19,7 +19,7 @@
# #
# #
__cdist_version="1.0.3" __cdist_version="1.1.0"
# Fail if something bogus is going on # Fail if something bogus is going on
set -u set -u

View file

@ -67,4 +67,4 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \
# And finally - execute the code # And finally - execute the code
cdist-code-run-all "$__cdist_target_host" cdist-code-run-all "$__cdist_target_host"
echo "Configuration successfully finished for $__cdist_target_host" echo "cdist $__cdist_version: Successfully finished run on $__cdist_target_host"

View file

@ -18,16 +18,26 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# Setup environment for use with cdist # Setup environment for use with cdist - must be standalone!
# #
. cdist-config __cdist_pwd="$(pwd -P)"
[ $# -eq 0 ] || __cdist_usage "no arguments" __cdist_mydir="${0%/*}";
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
__cdist_myname=${0##*/};
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
# Allow access to unset variables like PATH and MANPATH shell_binary=${SHELL##*/}
set +u
echo export PATH=$__cdist_abs_mydir:$PATH
NEWPATH="$__cdist_abs_mydir:$PATH"
cd "$__cdist_abs_mydir/../doc/man" cd "$__cdist_abs_mydir/../doc/man"
echo export MANPATH=$(pwd -P):$MANPATH NEWMANPATH="$(pwd -P):$MANPATH"
# Match csh, tcsh to handle differently
if [ "$(echo $shell_binary | grep 'csh$')" ]; then
echo setenv PATH $NEWPATH \;
echo setenv MANPATH $NEWMANPATH
else
echo export PATH=$NEWPATH
echo export MANPATH=$NEWMANPATH
fi

View file

@ -7,13 +7,14 @@
# Every machine becomes a marker, so sysadmins know that automatic # Every machine becomes a marker, so sysadmins know that automatic
# configurations are happening # configurations are happening
__file /etc/cdist-configured --type file __file /etc/cdist-configured
case "$__target_host" in case "$__target_host" in
# Everybody has this # Everybody has this
localhost) localhost)
# Usual example __link /tmp/cdist-testfile --source /etc/cdist-configured --type symbolic
__file test --type symlink --source /etc/cdist-configured --destination /tmp/cdist-testfile __directory /tmp/cdist-test-dir --mode 4777
__file /tmp/cdist-test-file --mode 0750 --owner nobody --group root
;; ;;
# #
@ -36,11 +37,17 @@ case "$__target_host" in
# Same stuff for gentoo # Same stuff for gentoo
__package tree --state installed __package tree --state installed
;; ;;
cdist-debian) cdist-debian)
__package_apt atop --state installed __package_apt atop --state installed
__package apache2 --state deinstalled __package apache2 --state deinstalled
;; ;;
cdist-redhat)
__issue
__motd
;;
# Real machines may be used with their hostname or fqdn, # Real machines may be used with their hostname or fqdn,
# depending on how you call cdist-deploy-to # depending on how you call cdist-deploy-to
# machine) # machine)

View file

@ -0,0 +1,50 @@
cdist-type__addifnosuchline(7)
==============================
Daniel Roth <dani-cdist--@--d-roth.li>
NAME
----
cdist-type__addifnosuchline - Add a line (if not existing already)
DESCRIPTION
-----------
This type can be used to check a file for existence of a
specific line and adding it, if it was not found.
REQUIRED PARAMETERS
-------------------
line::
Specifies the content which shall be added if not existing.
OPTIONAL PARAMETERS
-------------------
file::
If supplied, use this as the destination file.
Otherwise the object_id is used.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Creates or appends the line specifiend in "include_www" to the file "lighttpd.conf"
__addifnosuchline www --file /etc/lighttpd.conf --line include_www
# Adds the line "include_git" to the file "lighttpd.conf"
__addifnosuchline /etc/lighttpd.conf --line include_git
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Daniel Roth. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

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

57
conf/type/__directory/gencode Executable file
View file

@ -0,0 +1,57 @@
#!/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/>.
#
#
# Handle directories
#
#
# __directory /etc [--mode --owner --group --parents [yes|no] ]
#
destination="/$__object_id"
# Include parent directories?
if [ -f "$__object/parameter/parents" ]; then
parents="$(cat "$__object/parameter/parents")"
if [ yes = "$parents" ]; then
mkdiropt="-p"
else
mkdiropt=""
fi
fi
# Only create if not already existent
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo mkdir $mkdiropt \"$destination\"
fi
# Mode settings
if [ -f "$__object/parameter/mode" ]; then
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
fi
# Group
if [ -f "$__object/parameter/group" ]; then
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\"
fi
# Owner
if [ -f "$__object/parameter/owner" ]; then
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\"
fi

View file

@ -0,0 +1,56 @@
cdist-type__directory(7)
========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__directory - Create a directory
DESCRIPTION
-----------
This cdist type allows you to create directories on the target.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
group::
Group to chgrp to.
mode::
Unix permissions, suitable for chmod.
owner::
User to chown to.
parents::
Whether to create parents as well (mkdir -p behaviour)
EXAMPLES
--------
--------------------------------------------------------------------------------
# A silly example
__directory /tmp/foobar
# Ensure /etc exists correctly
__file /etc --owner root --group root --mode 0755
--------------------------------------------------------------------------------
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

@ -0,0 +1,4 @@
group
mode
owner
parents

View file

@ -21,28 +21,11 @@
# Retrieve the md5sum of a file to be created, if it is already existing. # Retrieve the md5sum of a file to be created, if it is already existing.
# #
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id" destination="/$__object_id"
fi
os="$(cat $__global/explorer/os)"
case "$os" in
macosx)
md5sum="md5"
;;
*)
md5sum="md5sum"
;;
esac
# 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 if [ -f "$destination" ]; then
$md5sum < "$destination" cksum < "$destination"
else else
echo "NO REGULAR FILE" echo "NO REGULAR FILE"
fi fi

View file

@ -21,11 +21,7 @@
# Check whether file exists or not # Check whether file exists or not
# #
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
destination="/$__object_id" destination="/$__object_id"
fi
if [ -e "$destination" ]; then if [ -e "$destination" ]; then
echo yes echo yes

View file

@ -18,62 +18,20 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# __file is a very basic type and should be able to be used as an # __file is a very basic type, which will probably be reused quite often
# example for typewrites later
# #
# If destination was specified, do not use the id
if [ -f "$__object/parameter/destination" ]; then
destination="$(cat "$__object/parameter/destination")"
else
# If no destination has been supplied, the id is the destination
# Prepend /, which got lost in the object id (and relative paths
# don't make sense)
destination="/$__object_id" destination="/$__object_id"
fi
# Ensure we have an absolute path
if ! $(echo "$destination" | grep -q ^/); then
echo "Error: Destination ($destination) of $__object_id is not absolute." >&2
exit 1
fi
# Use correct md5sum binary - MacOSx is different here
case "$os" in
macosx)
md5sum="md5"
;;
*)
md5sum="md5sum"
;;
esac
type="$(cat "$__object/parameter/type")"
case "$type" in
directory)
if [ -f "$__object/parameter/source" ]; then
echo "Source not supported for directory currently - FIXME" >&2
exit 1
else
if [ no = "$(cat "$__object/explorer/exists")" ]; then
echo mkdir \"$destination\"
fi
fi
;;
file)
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 if [ -f "$source" ]; then
local_md5sum="$($md5sum < "$source")" local_cksum="$(cksum < "$source")"
remote_md5sum="$(cat "$__object/explorer/md5sum")" remote_cksum="$(cat "$__object/explorer/cksum")"
# FIXME: Is md5sum the right approach? if [ "$local_cksum" != "$remote_cksum" ]; then
if [ "$local_md5sum" != "$remote_md5sum" ]; then # FIXME: The username is ugly and hardcoded, replace after 1.0!
# FIXME: This is ugly and hardcoded, replace after 1.0!
# Probably a better aproach is to have the user configured # Probably a better aproach is to have the user configured
# ~/.ssh/config to contain the right username # ~/.ssh/config to contain the right username
# Probably describe it in cdist-quickstart... # Probably describe it in cdist-quickstart...
@ -88,27 +46,19 @@ case "$type" in
echo touch \"$destination\" echo touch \"$destination\"
fi fi
fi fi
;;
symlink)
if [ ! -f "$__object/parameter/source" ]; then
echo "Source required for symlink" >&2
exit 1
fi
source="$(cat "$__object/parameter/source")"
# FIXME: handle directories or document & ignore?
echo ln -sf \"$source\" \"$destination\"
;;
*)
echo "Unsupported type: \"$type\"" >&2
exit 1
;;
esac
# Mode settings # Mode settings
if [ -f "$__object/parameter/mode" ]; then if [ -f "$__object/parameter/mode" ]; then
mode="$(cat "$__object/parameters/mode")" echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
echo chmod \"$mode\" \"$destination\" fi
# Group
if [ -f "$__object/parameter/group" ]; then
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\"
fi
# Owner
if [ -f "$__object/parameter/owner" ]; then
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\"
fi fi

View file

@ -15,19 +15,20 @@ This cdist type allows you to create files on the target.
REQUIRED PARAMETERS REQUIRED PARAMETERS
------------------- -------------------
type:: None.
Specifies the type of file to be created. Either "directory" or "file"
OPTIONAL PARAMETERS OPTIONAL PARAMETERS
------------------- -------------------
destination:: group::
If supplied, use this as the destination on the target. Otherwise the Group to chgrp to.
object_id is used.
mode:: mode::
Unix permissions, suitable for chmod. Unix permissions, suitable for chmod.
owner::
User to chown to.
source:: source::
If supplied, copy this file from the host running cdist to the target. If supplied, copy this file from the host running cdist to the target.
If not supplied, an empty file or directory will be created. If not supplied, an empty file or directory will be created.
@ -38,13 +39,14 @@ EXAMPLES
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
# Create /etc/cdist-configured as an empty file # Create /etc/cdist-configured as an empty file
__file /etc/cdist-configured --type file __file /etc/cdist-configured
# Same but with a different object id
__file cdist-marker --type file --destination /etc/cdist-configured
# Use __file from another type # Use __file from another type
__file /etc/issue --source "$__type/files/archlinux" --type file __file /etc/issue --source "$__type/files/archlinux"
# Supply some more settings
__file /etc/shadow --source "$__type/files/shadow" \
--owner root --group shadow --mode 0640
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -1,3 +1,4 @@
group
mode mode
owner
source source
destination

View file

@ -1 +0,0 @@
type

View file

@ -0,0 +1,3 @@
Red Hat Enterprise Linux Server (cdist-automated)
Kernel \r on an \m

View file

@ -1,5 +1,5 @@
cdist-type__issue(7) cdist-type__issue(7)
=================== ====================
Nico Schottelius <nico-cdist--@--schottelius.org> Nico Schottelius <nico-cdist--@--schottelius.org>

View file

@ -23,12 +23,12 @@ destination=/etc/issue
source="$(cat "out/explorer/os")" source="$(cat "out/explorer/os")"
case "$os" in case "$os" in
archlinux) archlinux|redhat)
source="$__type/files/archlinux" source="$__type/files/$os"
;; ;;
*) *)
source="$__type/files/default" source="$__type/files/default"
;; ;;
esac esac
__file "$destination" --source "$source" --type file __file "$destination" --source "$source"

43
conf/type/__link/gencode Executable file
View file

@ -0,0 +1,43 @@
#!/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/>.
#
#
# __file is a very basic type and should be able to be used as an
# example for typewrites later
#
destination="/$__object_id"
type="$(cat "$__object/parameter/type")"
source="$(cat "$__object/parameter/source")"
case "$type" in
symbolic)
lnopt="-s"
;;
hard)
lnopt=""
;;
*)
echo "Unknown type: $type" >&2
exit 1
;;
esac
echo ln ${lnopt} -f \"$source\" \"$destination\"

56
conf/type/__link/man.text Normal file
View file

@ -0,0 +1,56 @@
cdist-type__link(7)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__link - Create links
DESCRIPTION
-----------
This cdist type allows you to hard and symoblic links. The given
object id is the destination for the link.
REQUIRED PARAMETERS
-------------------
source::
Specifies the link source.
type::
Specifies the link type: Either hard or symoblic.
OPTIONAL PARAMETERS
-------------------
None.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Create hard link of /etc/shadow
__link /root/shadow --source /etc/shadow --type hard
# Relative symbolic link
__link /etc/apache2/sites-enabled/www.test.ch \
--source ../sites-available/www.test.ch \
--type symbolic
# Absolute symbolic link
__link /opt/plone --source /home/services/plone --type symbolic
--------------------------------------------------------------------------------
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

@ -0,0 +1,2 @@
source
type

View file

@ -33,7 +33,7 @@ EXAMPLES
__motd __motd
# Supply source file from a different type # Supply source file from a different type
__file --source "$__type/files/my-motd" __motd --source "$__type/files/my-motd"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -19,8 +19,6 @@
# #
# #
destination=/etc/motd
# Select motd source # Select motd source
if [ -f "$__object/parameter/source" ]; then if [ -f "$__object/parameter/source" ]; then
source="$(cat "$__object/parameter/source")" source="$(cat "$__object/parameter/source")"
@ -28,4 +26,16 @@ else
source="$__type/files/motd" source="$__type/files/motd"
fi fi
__file "$destination" --source "$source" --type file os=$(cat $__global/explorer/os)
case "$os" in
debian|ubuntu)
destination=/etc/motd.tail
;;
*)
destination=/etc/motd
;;
esac
__file "$destination" --source "$source" --mode 0644

View file

@ -0,0 +1,53 @@
cdist-type__package_apt(7)
==========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__package_apt - Manage packages with apt-get
DESCRIPTION
-----------
apt-get is usually used on Debian and variants (like Ubuntu) to
manage packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
OPTIONAL PARAMETERS
-------------------
name::
If supplied, use the name and not the object id as the package name.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__package_apt zsh --state installed
# In case you only want *a* webserver, but don't care which one
__package_apt webserver --state installed --name nginx
# Remove obsolete package
__package_apt puppet --state deinstalled
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
- cdist-type__package(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

@ -0,0 +1,53 @@
cdist-type__package_pacman(7)
=============================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__package_pacman - Manage packages with pacman
DESCRIPTION
-----------
Pacman is usually used on the Archlinux distribution to manage
packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "deinstalled".
OPTIONAL PARAMETERS
-------------------
name::
If supplied, use the name and not the object id as the package name.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__package_pacman zsh --state installed
# If you don't want to follow pythonX packages, but always use python
__package_pacman python --state installed --name python2
# Remove obsolete package
__package_pacman puppet --state deinstalled
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
- cdist-type__package(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

@ -1,10 +1,19 @@
1.0.4: 1.1.0: 2011-03-16
* Replace type __file with __file, __directory, __link
* Document cdist-env
* Document cdist-config
* Document cdist-dir
* Document cdist-quickstart
1.0.4: 2011-03-15
* New type __motd * New type __motd
* New type __addifnosuchline * New type __addifnosuchline (Daniel Roth)
* Document type __issue * Document type __issue
* New type __user * New type __user
* Document type __package * Document type __package
* Document type __package_emerge * Document type __package_pacman
* Document type __package_apt
* New parameter for __file: --owner and --group
1.0.3: 2011-03-11 1.0.3: 2011-03-11
* Update regexp used for sane characters * Update regexp used for sane characters

27
doc/dev/logs/2011-03-15 Normal file
View file

@ -0,0 +1,27 @@
Steven, Nico
How to handle dependencies:
1) Add --require parameter for all types
- Special handling in cdist-type-emulator
+ Everything on one line
2) Add __require type
+ No change in core
- Type influences core
- Additional line
- Core needs to know about requirements
3) cdist-require as a seperate executable
+ No change in cdist-type-emulator
- new behaviour
- first time cdist-xxx dependency in types
4) require="" environment variable for cdist-type-emulator
+ on one line / same context
+ special handling is ok for special case
+ doesn't touch parameters (i.e. type still has full control)
--------------------------------------------------------------------------------
Result: Use version 4.

View file

@ -0,0 +1,7 @@
Proposal for new types, which replace __file:
x __directory /etc [--mode --owner --group --parents [yes|no] ]
x __link /destination --source abc --type [symbolic|hard]
x __file /etc/passwd [--source] --mode --owner --group

View file

@ -0,0 +1 @@
Release 1.1.0

View file

@ -1,3 +1,7 @@
Core:
- write test case: test.sh
- probably remove grep -q (solaris does not have it)
Dependencies: Dependencies:
- Add meta parameters like --requires --excludes --depends? - Add meta parameters like --requires --excludes --depends?
- Build dependency tree - Build dependency tree
@ -9,22 +13,9 @@ Types to be written/extended:
- __service - __service
- __user - __user
- __file_edit - __file_edit
- delete_line_from_file - __deleteline
- regexp replace (can probably cover all?) - regexp replace (can probably cover all?)
- __file:
- template == [shell script] stdout
- cron - cron
- __file: think about splitting
__file
source
mode
owner
__directory
parents
mode
owner
__link
type symbolic | hard
- __issue: add --source - __issue: add --source
@ -41,16 +32,8 @@ Documentation:
+ cdist + cdist
+ cdist-deploy-to + cdist-deploy-to
+ cdist-manifest + cdist-manifest
- cdist-type [IMPORTANT]
- only do necessary work [TYPE IMPLEMENTATION HINTS]
- install packages only if not existent
- copy file only if different
- DOC document that $type/manifest is executed for every object/instance
- 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-deploy-to
- cdist-dir
- cdist-explorer-run-init - cdist-explorer-run-init
- cdist-manifest-run - cdist-manifest-run
- cdist-manifest-run-all - cdist-manifest-run-all
@ -58,7 +41,6 @@ Documentation:
- cdist-object-codegen - cdist-object-codegen
- cdist-object-codegen-all - cdist-object-codegen-all
- cdist-object-explorer-all - cdist-object-explorer-all
- cdist-quickstart
- cdist-remote-code-run-all - cdist-remote-code-run-all
- cdist-remote-explorer-run - cdist-remote-explorer-run
- cdist-run-remote - cdist-run-remote

View file

@ -10,18 +10,14 @@ cdist-config - Read basic cdist configuration
DESCRIPTION DESCRIPTION
----------- -----------
Cdist-config is sourced by all helper programs and provides Cdist-config is sourced by cdist programs and provides hints on where to find
hints on where to find the library. Cdist-config needs to be types, manifests, etc. Generally speaking, it's just usable from within the
in the path. core and is only of interest for cdist-developers.
AUTHOR
------
Nico Schottelius <mailto:nico-cdist--@--schottelius.org[]>
RESOURCES SEE ALSO
--------- --------
Main web site: http://www.nico.schottelius.org/cdist/[] cdist(7)
COPYING COPYING

38
doc/man/cdist-dir.text Normal file
View file

@ -0,0 +1,38 @@
cdist-dir(1)
============
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-dir - Poor man's directory synchronisation
SYNOPSIS
--------
cdist-dir <push|pull> TARGET_HOST SRC_DIR DST_DIR
DESCRIPTION
-----------
cdist-dir either pushes a local directory to the target host
or pulls a remote directory from a target host to the local host.
In the push case SRC_DIR is local, in the pull case remote.
In the push case DST_DIR is remote, in the pull case local.
cdist-dir does not cleanup DST_DIR and thus it may contain old
stuff if used multiple times.
cdist-dir does not rely on rsync or other high level tools, because
it cannot expect its existence on the local or target host.
SEE ALSO
--------
cdist(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).

46
doc/man/cdist-env.text Normal file
View file

@ -0,0 +1,46 @@
cdist-env(1)
============
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-env - Setup environment for using cdist
SYNOPSIS
--------
cdist-env
DESCRIPTION
-----------
cdist-env outputs two strings suitable for usage in your current shell,
so you can use cdist from the checkout. cdist-env essentially helps you
to easily setup PATH and MANPATH.
If you've multiple checkouts of cdist and run cdist-env from the various
checkouts, a new run will prepend the last directory, thus ensures you
can run it multiple times and does what one expects.
EXAMPLES
--------
For use in bourne shell variants (like dash, bash, ksh) as well as
in csh variants (csh, tcsh):
--------------------------------------------------------------------------------
eval `./bin/cdist-env`
--------------------------------------------------------------------------------
Replace "./" with the checkout directory of cdist.
SEE ALSO
--------
cdist(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

@ -0,0 +1,51 @@
cdist-quickstart(1)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-quickstart - Make use of cinit in 5 minutes
SYNOPSIS
--------
cdist-quickstart
DESCRIPTION
-----------
cdist-quickstart is an interactive guide to cdist. It should be one
of the first tools you use when you begin with cdist.
EXAMPLES
--------
To use cdist-quickstart, add the bin directory to your PATH,
execute cdist-quickstart and enjoy cdist:
--------------------------------------------------------------------------------
# Bourne shell example
export PATH=$(pwd -P)/bin:$PATH
# Alternatively, usable for csh and bsh, set's up PATH and MANPATH
eval `./bin/cdist-env`
# Let's go!
cdist-quickstart
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist(7)
- cdist-env(1)
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).
## How to use cdist?

View file

@ -179,6 +179,14 @@ level tools like ruby installed. If a type requires specific tools to be present
on the target, there must be another type that provides this tool and the first on the target, there must be another type that provides this tool and the first
type should create an object of the specific type. type should create an object of the specific type.
If your type wants to save temporay data, that may be used by other types
later on (for instance __file), you can save them in the subdirectory
"files" below $__object (but you must create it yourself). cdist will not touch
this directory.
If your type contains static files, it's also recommened to place them in
a folder named "files" within the type (again, because cdist guarantees to
never ever touch this folder).
HOW TO INCLUDE A TYPE INTO UPSTREAM CDIST HOW TO INCLUDE A TYPE INTO UPSTREAM CDIST
----------------------------------------- -----------------------------------------

View file

@ -1,42 +0,0 @@
cdist-quickstart(1)
===================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-quickstart - Make use of cinit in 5 minutes
DESCRIPTION
-----------
This document helps you to take the first steps with cdist.
We'll begin to configure the host "localhost" to have two files
in place, /etc/DO-NOT-CHANGE and /root/CDIST-ENABLED-HOST, which
both are used to warn other sysadmins that this system is managed
by configuration management and manual changes may get overwritten.
Begin to execute cdist-quickstart, it will show you the steps it
takes and explains what it does:
% cdist-quickstart
mkdir -p /etc/cdist/manifests
# Create
Cdist uses
kgives you an impression of
0. Create a host specification (/etc/cdist/hosts/**hostname**)
0. Add functionalilty to add
0. Run ***cdist-apply***
SEE ALSO
--------
cdist-config-layout(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).
## How to use cdist?

View file

@ -1,26 +0,0 @@
cdist-terms(7)
==============
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-terms - Describe terms used in cdist
DESCRIPTION
-----------
provider: Provides functionality.
object: Instance with provider unique id of a provider.
manifest: Define which objects to create [on hosts]
server: The machine that configures all targets.
target: Host that should be configured.
SEE ALSO
--------
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,30 +0,0 @@
cdist-type-addifnosuchline(1)
======================
Daniel Roth <dani-cdist--@--d-roth.li>
NAME
----
cdist-type-addifnosuchline
SYNOPSIS
--------
cdist-type-addifnosuchline Add if no such line
DESCRIPTION
-----------
cdist-type-addifnosuchline can be used to check a file for existence of a
specific line and adding that if not found
SEE ALSO
--------
cdist(7)
COPYING
-------
Copyright \(C) 2011 Daniel Roth. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -1,24 +0,0 @@
cdist-type-manifest(7)
======================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type-manifest - Manifest of a type
DESCRIPTION
-----------
CWD = object directory
ARGV = target host, basedir
ENV =
SEE ALSO
--------
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).