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

This commit is contained in:
Daniel Roth 2011-03-15 19:00:42 +01:00
commit f4d3c1d23e
13 changed files with 183 additions and 8 deletions

View file

@ -165,7 +165,8 @@ Yes, I'm actually eating my own dogfood and currently managing
* [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication) * [kerberos (mit)](http://web.mit.edu/kerberos/) (authentication)
* [ircd-hybrid](http://www.ircd-hybrid.org/) (chat) * [ircd-hybrid](http://www.ircd-hybrid.org/) (chat)
* [stunnel](http://stunnel.mirt.net/) (SSL tunnel) * [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 [Systems Group](http://www.systems.ethz.ch) at the
[ETH Zurich](http://www.ethz.ch). [ETH Zurich](http://www.ethz.ch).

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: success on $__cdist_target_host"

View file

@ -109,6 +109,15 @@ 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

@ -25,9 +25,15 @@ destination::
If supplied, use this as the destination on the target. Otherwise the If supplied, use this as the destination on the target. Otherwise the
object_id is used. object_id is used.
group::
Group to chgrp to.
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.
@ -45,6 +51,10 @@ __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" --type file
# Supply some more settings
__file /etc/shadow --source "$__type/files/shadow" --type file \
--owner root --group shadow --mode 0640
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

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

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

@ -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
os=$(cat $__global/explorer/os)
case "$os" in
debian|ubuntu)
destination=/etc/motd.tail
;;
*)
destination=/etc/motd
;;
esac
__file "$destination" --source "$source" --type file __file "$destination" --source "$source" --type file

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

@ -2,6 +2,8 @@
* New type __motd * New type __motd
* New type __addifnosuchline * New type __addifnosuchline
* Document type __issue * Document type __issue
* Document type __package_pacman
* 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

@ -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
----------------------------------------- -----------------------------------------