diff --git a/REAL_README b/REAL_README index 0938289f..88d5de13 100644 --- a/REAL_README +++ b/REAL_README @@ -165,7 +165,8 @@ Yes, I'm actually eating my own dogfood and currently managing * [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) -with cdist on a total of **3** production servers of the +with cdist on a total of **4** production servers of the [Systems Group](http://www.systems.ethz.ch) at the [ETH Zurich](http://www.ethz.ch). diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 35c058d9..7f66888f 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -67,4 +67,4 @@ cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \ # And finally - execute the code cdist-code-run-all "$__cdist_target_host" -echo "Configuration successfully finished for $__cdist_target_host" +echo "cdist $__cdist_version: success on $__cdist_target_host" diff --git a/conf/type/__file/gencode b/conf/type/__file/gencode index 5f386349..531cc203 100755 --- a/conf/type/__file/gencode +++ b/conf/type/__file/gencode @@ -109,6 +109,15 @@ esac # Mode settings if [ -f "$__object/parameter/mode" ]; then - mode="$(cat "$__object/parameters/mode")" - echo chmod \"$mode\" \"$destination\" + 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 diff --git a/conf/type/__file/man.text b/conf/type/__file/man.text index 04e0ffc3..c60ada44 100644 --- a/conf/type/__file/man.text +++ b/conf/type/__file/man.text @@ -25,9 +25,15 @@ destination:: If supplied, use this as the destination on the target. Otherwise the object_id is used. +group:: + Group to chgrp to. + mode:: Unix permissions, suitable for chmod. +owner:: + User to chown to. + 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. @@ -45,6 +51,10 @@ __file cdist-marker --type file --destination /etc/cdist-configured # Use __file from another type __file /etc/issue --source "$__type/files/archlinux" --type file + +# Supply some more settings +__file /etc/shadow --source "$__type/files/shadow" --type file \ + --owner root --group shadow --mode 0640 -------------------------------------------------------------------------------- diff --git a/conf/type/__file/parameter/optional b/conf/type/__file/parameter/optional index de17ffff..0c30f4be 100644 --- a/conf/type/__file/parameter/optional +++ b/conf/type/__file/parameter/optional @@ -1,3 +1,5 @@ +group mode +owner source destination diff --git a/conf/type/__issue/man.text b/conf/type/__issue/man.text index 57ece530..18d88947 100644 --- a/conf/type/__issue/man.text +++ b/conf/type/__issue/man.text @@ -1,5 +1,5 @@ cdist-type__issue(7) -=================== +==================== Nico Schottelius diff --git a/conf/type/__motd/man.text b/conf/type/__motd/man.text index 1fca60d3..a4ca80b5 100644 --- a/conf/type/__motd/man.text +++ b/conf/type/__motd/man.text @@ -33,7 +33,7 @@ EXAMPLES __motd # Supply source file from a different type -__file --source "$__type/files/my-motd" +__motd --source "$__type/files/my-motd" -------------------------------------------------------------------------------- diff --git a/conf/type/__motd/manifest b/conf/type/__motd/manifest index 594977b9..a6e963f1 100755 --- a/conf/type/__motd/manifest +++ b/conf/type/__motd/manifest @@ -19,8 +19,6 @@ # # -destination=/etc/motd - # Select motd source if [ -f "$__object/parameter/source" ]; then source="$(cat "$__object/parameter/source")" @@ -28,4 +26,16 @@ else source="$__type/files/motd" fi +os=$(cat $__global/explorer/os) + + +case "$os" in + debian|ubuntu) + destination=/etc/motd.tail + ;; + *) + destination=/etc/motd + ;; +esac + __file "$destination" --source "$source" --type file diff --git a/conf/type/__package_apt/man.text b/conf/type/__package_apt/man.text new file mode 100644 index 00000000..0780124d --- /dev/null +++ b/conf/type/__package_apt/man.text @@ -0,0 +1,53 @@ +cdist-type__package_apt(7) +========================== +Nico Schottelius + + +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). diff --git a/conf/type/__package_pacman/man.text b/conf/type/__package_pacman/man.text new file mode 100644 index 00000000..35a7e44c --- /dev/null +++ b/conf/type/__package_pacman/man.text @@ -0,0 +1,53 @@ +cdist-type__package_pacman(7) +============================= +Nico Schottelius + + +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). diff --git a/doc/changelog b/doc/changelog index c939b547..e712c15f 100644 --- a/doc/changelog +++ b/doc/changelog @@ -2,6 +2,8 @@ * New type __motd * New type __addifnosuchline * Document type __issue + * Document type __package_pacman + * New parameter for __file: --owner and --group 1.0.3: 2011-03-11 * Update regexp used for sane characters diff --git a/doc/dev/logs/2011-03-15 b/doc/dev/logs/2011-03-15 new file mode 100644 index 00000000..66de8aed --- /dev/null +++ b/doc/dev/logs/2011-03-15 @@ -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. diff --git a/doc/man/cdist-type.text b/doc/man/cdist-type.text index 7c8b49f3..f8811a16 100644 --- a/doc/man/cdist-type.text +++ b/doc/man/cdist-type.text @@ -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 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 -----------------------------------------