Merge branch 'master' into createcorelib

This commit is contained in:
Nico Schottelius 2011-07-26 22:01:36 +02:00
commit 5b9881bef6
73 changed files with 1175 additions and 42 deletions

View file

@ -3,7 +3,7 @@ cat << eof
Hey hackers,
this README is for you, for those who want to dig into cdist, hack it or try
to get a deeper understanding. Please read doc/man/cdist-hacker.text.
to get a deeper understanding. Please read doc/man/man7/cdist-hacker.text.
I hope you have a lot of fun with cdist, because it was also a lot of fun to
develop it!

4
README
View file

@ -109,8 +109,8 @@ how to use cdist.
There are at least the following branches available:
* master: the development branch
* 1.7: Bugfixes, cleanups, new type and explorer rename
* Development: master
* Current Stable: 1.7 (Bugfixes, cleanups, new type and explorer rename)
Old versions:

View file

@ -88,9 +88,9 @@ case "$1" in
speeches)
cd "$SPEECHESDIR"
for speech in *tex; do
pdflatex $speech
pdflatex $speech
pdflatex $speech
pdflatex "$speech"
pdflatex "$speech"
pdflatex "$speech"
done
;;
@ -108,7 +108,7 @@ case "$1" in
cd ${WEBDIR} && make pub
;;
pub)
p|pu|pub)
git push --mirror
git push --mirror github
;;

View file

@ -27,7 +27,11 @@ case "$__target_host" in
# Examples using different types
#
# Alias in /etc/hosts for localhost
#
# Use an alias in /etc/hosts for localhost to use these hosts:
#
# 127.0.0.1 localhost.localdomain localhost cdist-archlinux
#
cdist-archlinux)
# This is the specific package type for pacman
__package_pacman zsh --state installed
@ -46,7 +50,7 @@ case "$__target_host" in
cdist-debian)
__package_apt atop --state installed
__package apache2 --state deinstalled
__package apache2 --state removed
;;
cdist-redhat)

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
name="$__object_id"
if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then
echo "present"
else
echo "absent"
fi

View file

@ -0,0 +1,38 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
name="$__object_id"
state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/state")"
if [ "$state_should" != "$state_is" ]; then
case "$state_should" in
present)
owner=""
if [ -f "$__object/parameter/owner" ]; then
owner="-O '$(cat "$__object/parameter/owner")'"
fi
echo "su - postgres -c \"createdb $owner '$name'\""
;;
absent)
echo "su - postgres -c \"dropdb '$name'\""
;;
esac
fi

View file

@ -0,0 +1,44 @@
cdist-type__postgres_database(7)
================================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__postgres_database - create/drop postgres databases
DESCRIPTION
-----------
This cdist type allows you to create or drop postgres databases.
REQUIRED PARAMETERS
-------------------
state::
either 'present' or 'absent'
OPTIONAL PARAMETERS
-------------------
owner::
the role owning this database
EXAMPLES
--------
--------------------------------------------------------------------------------
__postgres_database mydbname --state present --owner mydbusername
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -0,0 +1 @@
owner

View file

@ -0,0 +1 @@
state

View file

@ -0,0 +1,27 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
name="$__object_id"
if su - postgres -c "psql -c '\du' | grep -q '^ *$name *|'"; then
echo "present"
else
echo "absent"
fi

View file

@ -0,0 +1,54 @@
#!/bin/sh
#
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
#
# 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/>.
#
name="$__object_id"
state_is="$(cat "$__object/explorer/state")"
state_should="$(cat "$__object/parameter/state")"
if [ "$state_is" != "$state_should" ]; then
case "$state_should" in
present)
optional="password
login
createdb
createrole
superuser"
for parameter in $optional; do
if [ -f "$__object/parameter/$parameter" ]; then
value="$(cat "$__object/parameter/$parameter")"
eval $parameter=$value
fi
done
[ -n "$password" ] && password="PASSWORD '$password'"
[ "$login" = "true" ] && login="LOGIN" || login="NOLOGIN"
[ "$createdb" = "true" ] && createdb="CREATEDB" || createdb="NOCREATEDB"
[ "$createrole" = "true" ] && createrole="CREATEROLE" || createrole="NOCREATEROLE"
[ "$superuser" = "true" ] && superuser="SUPERUSER" || superuser="NOSUPERUSER"
[ "$inherit" = "true" ] && inherit="INHERIT" || inherit="NOINHERIT"
cmd="CREATE ROLE $name WITH $password $login $createdb $createrole $superuser $inherit"
echo "su - postgres -c \"psql -c \\\"$cmd\\\"\""
;;
absent)
echo "su - postgres -c \"dropuser \\\"$name\\\"\""
;;
esac
fi

View file

@ -0,0 +1,58 @@
cdist-type__postgres_role(7)
============================
Steven Armstrong <steven-cdist--@--armstrong.cc>
NAME
----
cdist-type__postgres_role - manage postgres roles
DESCRIPTION
-----------
This cdist type allows you to create or drop postgres roles.
REQUIRED PARAMETERS
-------------------
state::
either 'present' or 'absent'
OPTIONAL PARAMETERS
-------------------
All optional parameter map directly to the corresponding postgres createrole
parameters.
password::
login::
createdb::
createrole::
superuser::
inherit::
EXAMPLES
--------
--------------------------------------------------------------------------------
__postgres_role myrole --state present
__postgres_role myrole --state present --password 'secret'
__postgres_role admin --state present --password 'very-secret' --superuser true
__postgres_role dbcustomer --state present --password 'bla' --createdb true
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
- http://www.postgresql.org/docs/current/static/sql-createrole.html
COPYING
-------
Copyright \(C) 2011 Steven Armstrong. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

View file

@ -0,0 +1,6 @@
password
login
createdb
createrole
superuser
inherit

View file

@ -0,0 +1 @@
state

View file

@ -35,16 +35,16 @@ EXAMPLES
--------
--------------------------------------------------------------------------------
# Start /usr/sbin/sshd if not running
__process /usr/sbin/sshd --state running
# Start if not running
__process /usr/sbin/syslog-ng --state running
# Start /usr/sbin/sshd if not running with a different binary
__process /usr/sbin/sshd --state running --start "/etc/rc.d/sshd start"
# Start if not running with a different binary
__process /usr/sbin/nginx --state running --start "/etc/rc.d/nginx start"
# Stop the process using kill (the type default)
# Stop the process using kill (the type default) - DO NOT USE THIS
__process /usr/sbin/sshd --state stopped
# Stop the process using /etc/rc.d/sshd stop
# Stop the process using /etc/rc.d/sshd stop - THIS ONE NOT AS WELL
__process /usr/sbin/sshd --state stopped --stop "/etc/rc.d/sshd stop"
# Ensure cups is running, which runs with -C ...:

View file

@ -0,0 +1,2 @@
>eof
129.132.186.89 # sgv-afs-sur5r

View file

@ -0,0 +1 @@
eof

View file

@ -0,0 +1,28 @@
[libdefaults]
default_realm = EOF
# The following krb5.conf variables are only for MIT Kerberos.
krb4_config = /etc/krb.conf
krb4_realms = /etc/krb.realms
kdc_timesync = 1
ccache_type = 4
forwardable = true
proxiable = true
allow_weak_crypto = true
[realms]
EOF = {
kdc = sgv-afs-sur5r.ethz.ch
admin_server = sgv-afs-sur5r.ethz.ch
}
[login]
krb4_convert = true
krb4_get_tickets = false
[logging]
default = FILE:/var/log/krb5.log
kdc = FILE:/var/log/krb5kdc/kdc.log
admin_server = FILE:/var/log/krb5kdc/kadmin.log

View file

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Gbl64LT3VD5hsVtk1w670S2gue1OaW9XLg/Vk/iBqsYYrLGZh+TXJsAsXOSF1sZH6QSdNlpzTPsno9KFCTQTNlYe0IrWPGRrFGw1or3M6OugJrMeSiMYQ5nhH6HMjhzCFHH8Xh4Yku8fgi3ejPpySW8umx7nBL7ndiEJ9Y+lixNWMirEPLpz9YufFm9u8GX6bPrmjIBz6EhfxaqJ2N/N6gQB+4PmNopzqWHm+n4LToA9N8qwetSfhgEg7DVaD9SrJNjNTGSgii6CritT9sF8ZBq5CZG58DTyrxCndhhHte5OCGMb5ENgO4OBHA0MrD56unHrdAZCCosa9rI+pIll abr@cltHome03

View file

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17fnWJMTAuIvWcdnsasdfEkBabeXEhYaR03Qc/KBpS+iToSeUzlc5SeXoAczqSMsC0uYpDnhll9q3aAN82Xo06RI2ytd7TeXvFcVwzvXB+sNUsvtyPZ5Uyx7d2WTI87bm169KhGTJCaww8p+qa2UhkjOOaXZwMGjkHlvZ3WSZr5mLar9O3r4PG8SIqoFF0m+tcc2fcWIK3df3jWIk8g6j/jTaoIa18qsK/rtO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XOhSD8f/LIr5mjLEpSta6rHS/3dpLpSRGIy8ReG0RLbfay/fS74Iw0rEGOe/XgrfNDT0VwsgJMNV81sReepk27DaFD/vES/iPAymbbId8e8IQ7kDbhV0yK0yTkCZ5capqa9HXcut0SFRVJYGxzGT+ji5o/DcyAcaQHK9IW5i89sp04aVtZO+KZZDd2GmcDy+v9+fmBsSx2AFsoOQSXX31jJVdAXNw8idTNb88/3XDZIIEl+1KJ8Pv4UFXBW72RArpOxOrsDZYQjtaLQ4ZjTP3h823ZrBh4W3osb1znS7x4MmWBLPkmLCS0zmN8nbqhKi5EsTmSheCjCzySGShkyeqSGRIRGFk5PUsgh7hYvE+f7BhWD6x8MHbuUp9y0ODQonp022Dc4WzTc6Aa023MSNRuwV373tOqPYveuoPXDTS6vzV3IjXfv9a844HIkUTZbErxkavGBN5TEMgrALJkc8LS6M6Zg8odou8N2vWoNaKPn/DC5+H+FxJ2PSrK93hfzRMgvFvPSFzzDnixUFJClSqxf1Wvx9OW2pUuePAXBlcuFhAAnWV6w7fkmII8+qGk3m438dt2Sq6owmItzqIeJ6bohMsb9ejxeDyfk9DAQwmjS7S+BY47bYgAfsesZNRnlbeffp4rP0MAx4KoUXoNzb8tl1Jljulq58C0e5+EzRILqOYLM7WytY3+giqxN4zQJsqDp3mgSUaZ5SEHnA8JVi77MvABSoVclrEaujSLVEkxTBOiR252SFUWp3lWbxpGzBjd7gX4JAiytJql5xr+o4+nCy2O2laE6c2xS7en6SVEgC7jWflCsbDfvy9U+w1qOxa0j9fXE9Rw== sur5r@samsa

View file

@ -0,0 +1,45 @@
#!/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/>.
#
#
__directory /root/.ssh --mode 0700
__file /root/.ssh/authorized_keys --mode 0600
cd "$__type/files/ssh"
for key in *; do
require="__directory/root/.ssh" \
__addifnosuchline ssh-$key --file /root/.ssh/authorized_keys \
--line "$(cat "$key")"
done
for pkg in openafs-client openafs-krb5 krb5-user; do
__package $pkg --state installed
done
# Kerberos Config
__file /etc/krb5.conf --source "$__type/files/krb5/krb5.conf"
# AFS config
cd "$__type/files/afs"
for afsconf in *; do
__file /etc/openafs/$afsconf --source "$__type/files/afs/$afsconf"
done

View file

@ -0,0 +1 @@
scheibe

View file

@ -0,0 +1,4 @@
# Use slim, not gdm, if both are available
# Setup for slim, but value is available for gdm as well:
# gdm shared/default-x-display-manager select slim
slim shared/default-x-display-manager select slim

View file

@ -0,0 +1,47 @@
#!/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/>.
#
#
#
# Ensure hostname is setup
#
__file /etc/hostname --source "$__object/parameter/hostname"
# All Linux distros have those
for pkg in dvdbackup mplayer x11vnc xfmpc; do
__package $pkg --state installed
done
case "$(cat "$__global/explorer/os")" in
debian|ubuntu)
require="__package/zsh" __user lyni --uid 1000 --shell /bin/zsh
for pkg in chromium-browser xfce4 xtightvncviewer; do
__package $pkg --state installed
done
# Make slim default desktop on Debian/Ubuntu
__debconf_set_selections slim --file "$__type/files/slim-preseed"
require="__debconf_set_selections/slim" __package_apt slim --state installed
;;
esac
# Including gaming fun - not within examples, too big for core inclusion :-p
# __nico_dosbox

View file

@ -0,0 +1 @@
hostname

View file

@ -0,0 +1,4 @@
# Use slim, not gdm, if both are available
# Setup for slim, but value is available for gdm as well:
# gdm shared/default-x-display-manager select slim
slim shared/default-x-display-manager select slim

View file

@ -0,0 +1,24 @@
#!/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/>.
#
#
__package mpd --state installed
require="__package/mpd" __file /etc/mpd.conf --source "$__type/files/mpd.conf"

View file

@ -0,0 +1 @@
hostname

View file

@ -0,0 +1,6 @@
# generated by cdist
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

View file

@ -0,0 +1,11 @@
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-ssid undef
wpa-psk rotrussland

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/>.
#
#
case "$(cat "$__global/explorer/os")" in
debian|ubuntu)
interface="$(cat $__object/parameter/interface)"
#
# Only Debian and alike supported currently
#
destination=/etc/network/interfaces
case "$interface" in
eth0|wlan0)
source="$__type/files/interfaces-${interface}"
;;
*)
echo "Unknown interface: $interface" >&2
exit 1
;;
esac
__file "$destination" --source "$source"
;;
esac

View file

@ -0,0 +1 @@
interface

View file

@ -0,0 +1,4 @@
# Use slim, not gdm, if both are available
# Setup for slim, but value is available for gdm as well:
# gdm shared/default-x-display-manager select slim
slim shared/default-x-display-manager select slim

View file

@ -0,0 +1,47 @@
#!/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/>.
#
#
__directory /home/services
for nfsshare in audio video; do
dir="/home/services/$nfsshare"
__addifnosuchline nfs-$nfsshare --file /etc/fstab \
--line "192.168.42.1:$dir $dir nfs defaults 0 0"
require="__directory/home/services" __directory $dir
done
__directory /home/services/eingehend
for nfsshare in bibliothek buch spiegel; do
dir="/home/services/eingehend/$nfsshare"
__addifnosuchline nfs-$nfsshare --file /etc/fstab \
--line "192.168.42.1:$dir $dir nfs defaults,noauto 0 0"
require="__directory/home/services" __directory $dir
done
case "$(cat "$__global/explorer/os")" in
debian|ubuntu)
__package nfs-common --state installed
;;
fedora|archlinux)
__package nfs-utils --state installed
;;
esac

View file

@ -0,0 +1,38 @@
#!/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/>.
#
#
require="__package/zsh" __user nico --uid 1000 --shell /bin/zsh
#
# Backup HD
#
for hd in usbhd eth-usbhd; do
dir="/home/services/$hd"
__addifnosuchline hd-$hd --file /etc/fstab \
--line "/dev/mapper/$hd $dir auto defaults,noauto 0 0"
__directory $dir
done
#
# Standard everywhere packages
#
__nico_packages
__motd

View file

@ -0,0 +1,33 @@
#!/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/>.
#
#
for pkg in atop screen vim wget zsh; do
__package "$pkg" --state installed
done
case "$(cat "$__global/explorer/os")" in
fedora)
__package nc --state installed
;;
*)
__package netcat --state installed
;;
esac

View file

@ -0,0 +1,13 @@
#
# Cdist managed file
#
# Personal one: nico, shared one: lyni
User_Alias NICO = nico, lyni
Defaults timestamp_timeout=5
Defaults !tty_tickets
# Give out permissions
NICO ALL=(ALL) ALL
NICO ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend

View file

@ -0,0 +1,27 @@
#!/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/>.
#
#
destination=/etc/sudoers.d/nico
source="$__type/files/sudo-nico"
require="__package/sudo" __file "$destination" --source "$source" --mode 0440
__package sudo --state installed

View file

@ -0,0 +1,31 @@
#!/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/>.
#
#
# USEFUL DESCRIPTION
#
#
# This file should generate code on stdout, which will be collected by cdist
# and run on the target.
#
# To tell cdist to make use of it, you need to make it executable (chmod +x)
#
#

View file

@ -0,0 +1,31 @@
#!/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/>.
#
#
# USEFUL DESCRIPTION
#
#
# This is the manifest, which can be used to create other objects like this:
# __file /path/to/destination --source /from/where/
#
# To tell cdist to make use of it, you need to make it executable (chmod +x)
#
#

View file

@ -0,0 +1,2 @@
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

View file

@ -0,0 +1 @@
scheibe

View file

@ -0,0 +1,28 @@
#!/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/>.
#
#
__package unattended-upgrades --state installed
__file /etc/apt/apt.conf.d/99-apt-nico \
--source "$__type/files/99-apt-nico" \
--mode 0644

View file

@ -0,0 +1,5 @@
This type was not accepted, because cleanups are needed and the
manpage does not build.
If you read this and want this code available in the cdist core,
just fix it and submit a git url :-)

View file

@ -0,0 +1,30 @@
#!/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/>.
#
#
# Retrieve the status of a package - parsed dpkg output
#
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
rpm -q --whatprovides "$name" 2>/dev/null || true

View file

@ -0,0 +1,51 @@
#!/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/>.
#
#
# Manage packages with yum (mostly Fedora)
#
if [ -f "$__object/parameter/name" ]; then
name="$__object/parameter/name"
else
name="$__object_id"
fi
state="$(cat "$__object/parameter/state")"
opts="-n -q"
not_installed="^no package provides"
case "$state" in
installed)
if grep -q "$not_installed" "$__object/explorer/pkg_version"; then
echo zypper $opts install \"$name\"
fi
;;
removed)
if ! grep -q "$not_installed" "$__object/explorer/pkg_version"; then
echo zypper $opts remove \"$name\"
fi
;;
*)
echo "Unknown state: $state" >&2
exit 1
;;
esac

View file

@ -0,0 +1,52 @@
cdist-type__package_zypper(7)
==========================
Franky Van Liedekerke <franky.van.liedekerke--@--telenet.be>
NAME
----
cdist-type__package_zypper - Manage packages with zypper
DESCRIPTION
-----------
zypper is usually used on the Suse distribution to manage packages.
REQUIRED PARAMETERS
-------------------
state::
Either "installed" or "removed".
OPTIONAL PARAMETERS
-------------------
name::
If supplied, use the name and not the object id as the package name.
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__package_zypper zsh --state installed
# If you don't want to follow pythonX packages, but always use python
__package_zypper python --state installed --name python2
# Remove obsolete package
__package_zypper puppet --state removed
--------------------------------------------------------------------------------
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 @@
name

View file

@ -0,0 +1 @@
state

View file

@ -1,7 +1,9 @@
1.7.1:
1.7.1: 2011-07-26
* Documentation: Add explorers to reference
* Documentation: Typo cleanup (Derek Brost)
* Type __key_value: Bugfix (Steven Armstrong)
* New Type: __postgres_role (Steven Armstrong)
* New Type: __postgres_database (Steven Armstrong)
1.7.0: 2011-05-10
* Bugfix type __package_yum: Fix redhat support (Ramon Salvadó)

24
doc/dev/lastchanges Executable file
View file

@ -0,0 +1,24 @@
#!/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/>.
#
#
# Show the lastest changes from this (upcoming) release
#
awk '/^$/ { exit } { print $0 } END { print "-----" }' < "${0%/*}/../changelog"

View file

@ -43,6 +43,15 @@ CORE
and have it parsable by different (shinken) tool
-> given after manifest run already!
- Allow types to have parameters without values (boolean flags).
e.g. __chair fancychair --pink --wood
would result in:
$__object/parameter/
pink # empty file
wood # empty file
- allow cdist to run without $PATH setup: ./bin/cdist-deploy-to
TYPES
------
- __ssh-keys (host/user)

View file

@ -1,16 +0,0 @@
- document object_id=$1 for manifest + gencode :-)
- update docs regarding flow in cdist-stages.text
- create man pages for new executables
- nuke legacy manpages
- prettify output of cdist-deploy-to, e.g.
Processing object __file/etc/cdist-configured
transfering type explorers ...
running type explorers ...
running manifest ...
running gencode ...
transfering object to target ...
running code ...

View file

@ -1,5 +0,0 @@
- align messages (already in todo for steven, but makes life much easier, thus repeated)
-> prefix all object stuff with $__self
-> __cdist_echo object string
-> $__cdist_object_self :-)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -10,20 +10,18 @@ cdist-manifest-run - Run a given manifest
SYNOPSIS
--------
cdist-manifest-run HOSTNAME MANIFEST OUTPUT_DIR
cdist-manifest-run HOSTNAME MANIFEST
DESCRIPTION
-----------
cdist-manifest-run executes the given MANIFEST and saves the output into
OUTPUT_DIR.
cdist-manifest-run executes the given MANIFEST.
SEE ALSO
--------
- cdist(7)
- cdist-deploy-to(1)
- cdist-manifest-run-all(1)
- cdist-manifest-run-init(1)

View file

@ -70,7 +70,6 @@ require="__file/etc/cdist-configured __link/tmp/cdist-testfile" \
SEE ALSO
--------
- cdist-manifest-run(1)
- cdist-manifest-run-all(1)
- cdist-manifest-run-init(1)
- cdist-type(7)

View file

@ -0,0 +1,242 @@
% first presentation about cmtp
\pdfminorversion=4
%\documentclass[ucs]{beamer}
\documentclass{beamer}
%\documentclass[utf8]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{german}
\usepackage{graphicx}
\usepackage{beamerthemesplit}
\setbeamercovered{dynamic}
\usetheme{Malmoe}
\usecolortheme{crane}
\title{cdist - nutzbare Konfigurationsverwaltung}
\subtitle{Cosin 2011}
\author{Nico -telmich- Schottelius}
\date{25. Juni 2011}
\begin{document}
\frame{\titlepage}
%\section[Outline]{}
\frame{\tableofcontents}
\section{Einleitung}
\frame
{
\frametitle{Was ist das Problem?}
\begin{itemize}
\item Einmal konfigurieren = toll
\item Zweimal konfigurieren = naja, ...
\item Neue Sachen machen mehr Spass als alte wiederholen
\item Viele Rechner = viel Mühe?
\end{itemize}
}
\frame
{
\frametitle{Das ist nicht neu...}
\begin{itemize}
\item cfengine
\item Puppet
\item bcfg2
\item chef
\item ...
\end{itemize}
}
\frame
{
\frametitle{Warum cdist?}
\begin{itemize}
\item Klein
\item Unix
\item Leicht zu bedienen
\item ... zu erweitern
\item Shell
\item Weil es Spaß macht!
\end{itemize}
}
\section{Installieren}
\frame
{
\frametitle{Vorraussetzungen}
\begin{itemize}
\item sshd
\item root login via sshd
\item Besser: ssh-pubkey konfiguriert (PermitRootLogin without-password)
\item git
\item Asciidoc für dia manpages
\end{itemize}
}
\frame
{
\frametitle{Installation}
\begin{center}
git clone git://git.schottelius.org/cdist
\end{center}
}
\begin{frame}[fragile]
\frametitle{Erstellen der Manpages}
\begin{verbatim}
# Braucht asciidoc / a2x
./build.sh man
\end{verbatim}
\end{frame}
\section{Nutzen}
\begin{frame}[fragile]
\frametitle{Vorbereitung PATH und MANPATH}
\begin{verbatim}
cd cdist
eval `./bin/cdist-env`
echo $PATH
echo $MANPATH
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Nun los}
\begin{verbatim}
# Fangen wir bei uns an
cdist-deploy-to localhost
\end{verbatim}
\end{frame}
\begin{frame}[fragile]
\frametitle{Der Einstiegspunkt}
\begin{small}
\begin{verbatim}
cat << eof > conf/manifest/init
__file /etc/cdist-configured
case "$__target_host" in
localhost)
__link /tmp/cdist-testfile \
--source /etc/cdist-configured \
--type symbolic
__addifnosuchline /tmp/cdist-welcome \
--line "Welcome to cdist"
;;
esac
eof
# Muss ausführbar sein
chmod u+x conf/manifest/init
\end{verbatim}
\end{small}
\end{frame}
\begin{frame}[fragile]
\frametitle{Nun los}
\begin{verbatim}
# Nun läuft es!
cdist-deploy-to localhost
\end{verbatim}
\end{frame}
\frame
{
\frametitle{Funktionalität zusammenfassen}
\begin{itemize}[<+->]
\item "`Typen"' (types)
\item conf/type/*
\item \_\_ vor jedem Namen (Shell-Umgebung)
\item z.B. Netzseite, Mailserver, Wiki, ...
\end{itemize}
}
\begin{frame}[fragile]
\frametitle{Ein neuer Typ}
\begin{small}
\begin{verbatim}
% mkdir conf/type/__my_mailserver
% cat << eof > conf/type/__my_mailserver/manifest
# Dieser Typ konfiguriert meinen Mailserver
require="__package/nullmailer" \
__file /etc/nullmailer/remotes \
--source "$__type/files/remotes"
# Reihenfolge spielt keine Rolle
__package nullmailer --state installed
eof
\end{verbatim}
\end{small}
\end{frame}
\begin{frame}[fragile]
\frametitle{Ein neuer Typ (2)}
\begin{small}
\begin{verbatim}
# Wichtig: Wird ausgeführt
% chmod u+x conf/type/__my_mailserver/manifest
# Darf nur einmal verwendet werden pro Rechner
% touch conf/type/__my_mailserver/singleton
# Nullmailer Konfiguration
% mkdir conf/type/__my_mailserver/files
% echo my.fancy.smart.host > \
conf/type/__my_mailserver/files/remotes
\end{verbatim}
\end{small}
\end{frame}
\begin{frame}[fragile]
\frametitle{Neuen Typ nutzen}
\begin{small}
\begin{verbatim}
% $EDITOR conf/manifest/init
case "$__target_host" in
localhost)
...
__my_mailserver
...
;;
\end{verbatim}
\end{small}
\end{frame}
\section{Aktualisieren}
\begin{frame}[fragile]
\frametitle{Versionen}
\begin{itemize}[<+->]
\item x.y: Stabile Version
\item master: Entwicklung
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Stabile Version auswählen}
\begin{center}
git checkout -b 1.7 origin/1.7
\end{center}
\end{frame}
\begin{frame}[fragile]
\frametitle{Aktualisieren}
\begin{center}
git pull
\end{center}
\end{frame}
\frame
{
\frametitle{Ende}
\begin{block}{Das war's}
Viel Spaß - Mehr Infos gibt's auf http://www.nico.schottelius.org/software/cdist/\\
und http://l.schottelius.org/pipermail/cdist
\end{block}
}
\end{document}