diff --git a/HACKERS_README b/HACKERS_README index 66103acc..ad3fe3fd 100755 --- a/HACKERS_README +++ b/HACKERS_README @@ -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! diff --git a/README b/README index 635d381d..295b9152 100644 --- a/README +++ b/README @@ -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: diff --git a/build.sh b/build.sh index b1d27817..a6897d49 100755 --- a/build.sh +++ b/build.sh @@ -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 ;; diff --git a/conf/manifest/init.sample b/conf/manifest/init.sample index 1863a784..fca959e2 100755 --- a/conf/manifest/init.sample +++ b/conf/manifest/init.sample @@ -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) diff --git a/conf/type/__postgres_database/explorer/state b/conf/type/__postgres_database/explorer/state new file mode 100755 index 00000000..dc9659e2 --- /dev/null +++ b/conf/type/__postgres_database/explorer/state @@ -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 . +# + +name="$__object_id" + +if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then + echo "present" +else + echo "absent" +fi diff --git a/conf/type/__postgres_database/gencode-remote b/conf/type/__postgres_database/gencode-remote new file mode 100755 index 00000000..c097efce --- /dev/null +++ b/conf/type/__postgres_database/gencode-remote @@ -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 . +# + +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 diff --git a/conf/type/__postgres_database/man.text b/conf/type/__postgres_database/man.text new file mode 100644 index 00000000..06cb736f --- /dev/null +++ b/conf/type/__postgres_database/man.text @@ -0,0 +1,44 @@ +cdist-type__postgres_database(7) +================================ +Steven Armstrong + + +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). diff --git a/conf/type/__postgres_database/parameter/optional b/conf/type/__postgres_database/parameter/optional new file mode 100644 index 00000000..7ee3bde8 --- /dev/null +++ b/conf/type/__postgres_database/parameter/optional @@ -0,0 +1 @@ +owner diff --git a/conf/type/__postgres_database/parameter/required b/conf/type/__postgres_database/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__postgres_database/parameter/required @@ -0,0 +1 @@ +state diff --git a/conf/type/__postgres_role/explorer/state b/conf/type/__postgres_role/explorer/state new file mode 100755 index 00000000..8c102df9 --- /dev/null +++ b/conf/type/__postgres_role/explorer/state @@ -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 . +# + +name="$__object_id" + +if su - postgres -c "psql -c '\du' | grep -q '^ *$name *|'"; then + echo "present" +else + echo "absent" +fi diff --git a/conf/type/__postgres_role/gencode-remote b/conf/type/__postgres_role/gencode-remote new file mode 100755 index 00000000..a3280c09 --- /dev/null +++ b/conf/type/__postgres_role/gencode-remote @@ -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 . +# + +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 diff --git a/conf/type/__postgres_role/man.text b/conf/type/__postgres_role/man.text new file mode 100644 index 00000000..a7264870 --- /dev/null +++ b/conf/type/__postgres_role/man.text @@ -0,0 +1,58 @@ +cdist-type__postgres_role(7) +============================ +Steven Armstrong + + +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). diff --git a/conf/type/__postgres_role/parameter/optional b/conf/type/__postgres_role/parameter/optional new file mode 100644 index 00000000..c5abb57f --- /dev/null +++ b/conf/type/__postgres_role/parameter/optional @@ -0,0 +1,6 @@ +password +login +createdb +createrole +superuser +inherit diff --git a/conf/type/__postgres_role/parameter/required b/conf/type/__postgres_role/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/conf/type/__postgres_role/parameter/required @@ -0,0 +1 @@ +state diff --git a/conf/type/__process/man.text b/conf/type/__process/man.text index 3f7004c7..fd3bcf49 100644 --- a/conf/type/__process/man.text +++ b/conf/type/__process/man.text @@ -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 ...: diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB b/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB new file mode 100644 index 00000000..dbd238d7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/afs/CellServDB @@ -0,0 +1,2 @@ +>eof +129.132.186.89 # sgv-afs-sur5r diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell b/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell new file mode 100644 index 00000000..37fb719b --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/afs/ThisCell @@ -0,0 +1 @@ +eof diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf b/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf new file mode 100644 index 00000000..3b8259cb --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/krb5/krb5.conf @@ -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 + diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub new file mode 100644 index 00000000..222410d5 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/JAS.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Gbl64LT3VD5hsVtk1w670S2gue1OaW9XLg/Vk/iBqsYYrLGZh+TXJsAsXOSF1sZH6QSdNlpzTPsno9KFCTQTNlYe0IrWPGRrFGw1or3M6OugJrMeSiMYQ5nhH6HMjhzCFHH8Xh4Yku8fgi3ejPpySW8umx7nBL7ndiEJ9Y+lixNWMirEPLpz9YufFm9u8GX6bPrmjIBz6EhfxaqJ2N/N6gQB+4PmNopzqWHm+n4LToA9N8qwetSfhgEg7DVaD9SrJNjNTGSgii6CritT9sF8ZBq5CZG58DTyrxCndhhHte5OCGMb5ENgO4OBHA0MrD56unHrdAZCCosa9rI+pIll abr@cltHome03 diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub new file mode 100644 index 00000000..cccbe02f --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/bugblue.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17fnWJMTAuIvWcdnsasdfEkBabeXEhYaR03Qc/KBpS+iToSeUzlc5SeXoAczqSMsC0uYpDnhll9q3aAN82Xo06RI2ytd7TeXvFcVwzvXB+sNUsvtyPZ5Uyx7d2WTI87bm169KhGTJCaww8p+qa2UhkjOOaXZwMGjkHlvZ3WSZr5mLar9O3r4PG8SIqoFF0m+tcc2fcWIK3df3jWIk8g6j/jTaoIa18qsK/rtO90Ql20FMQJOZTKGKjHIOx2FLnXY5WKrXmXyyffgFpqi1rUAkCkjCKnm65fDjecn6FplzSUuZo/IB2GnHGNQVnNkU/18/G8KQKu9clkMxuUl8DYJBQ== bugblue@jabber.eof.name diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub new file mode 100644 index 00000000..4b40d089 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/docsteel.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1xfKoN8D3I0uGvc66E2cpnutdgALbSVIIWy0SBGV1ZLA4CehAL5BpMO0EI1TfH4LGgpjg+CnLXOSMd+bnvWjPTxGUbGcmK45UYCyn1LzSAfVKi9Mr06wbvQj0h5w1zEAwDqt63SHGjGOHO4TeCSrPxEROPMbZ1mP1ECsb4f+3WLWE5icbzOb/QMx2zNDd29rVvFJiJMOg4AiIs7pl/T7Qxg2yN6YlDIXSXLiE2i98O26kBNWRgAFcTNBqoUs5AkZ2F4LPUGbyuLpV+wtlpYcQXOUTLoRlKw+ovBQH3L6ae9n6+rFTIEEAS08C0MOzQPC3QjmfRMC8mxVkn22XnpHbQ== default diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub new file mode 100644 index 00000000..bde07c29 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/downhill.pub @@ -0,0 +1 @@ +ssh-dss AAAAB3NzaC1kc3MAAAIBAMiYvUWD0Yq3vm2Dp6xJCGvRGcGIyiT8+07FQJvAWUAzudyhA9r+h58gm4uCUJTV5W33Npf70Id5LSxyZJA7LcdTXTuMxhVfERURcT/GgtxCrs+aMguitNvf7QVuiKBrvuBmBPMV/6k8UEwf/7eCQRjoXE4jxEYKUT9SW8X94wuH0HUqOqBRD2F21uMrmLgDkb12RK/9yFRV3c7waOSQU/QtO+VFwPvBNDqUTqBL0LOJJif449vMxboOZ1noS94K0Lyfz9yOGEwBYck11c2UzH4KXbv8qNpYgtuCmDjZFM2J8dnhWJgkmThZtmyfnNFbHlW0HZItVvkqLZMPDlCIqR77J9OC4lawjrX2FFKhAzcrJuw7WXr2PcFKQUh/TiypcM5f6zuU3fs2+8ZYQdwvU6j/QNW4A/zqud7v/hjAMYCVe0EIWf2Qt0SS/nFLh7dZRGV21nK9Vq0zDncVPTgDl7/L62TYieO/j/1X3HjEp2JbR+mjBWsfKM7WYZDP16xiQzBuhr0vItnKMyN9V4AbDthjqesezKuXIhv0jP1z40MppM9mr40FJpgRSY3hyt3cZQKoO2vVJevnJMuufLheocAxo037f2PUpmSiJDOF1dLywmS2Gqk4GgzNN40IPrOcz0umtKjMAtXeU6MeapfmmEbwk+2zOo75gUt6SWU8UiFhAAAAFQC/Fm0V7OYGdazrUNuyn7mcPknZhQAAAgBzO496WPYnn7/H336kdMOUoue4Kgr9shpgjyyTJ8K9UsFwm+IEh9iS0QKPgGnj54AY1FpspfrbCmRI0tma+pj2QlnRRwIGcHd7eh2nCOmr+DSD/36VmoRPvGZaJDSTVotN+qgyjddNhCGx0417fqHXSKypbASphBqyvcKwkpk8S7o5nkMeOhufeCNdTHYsenKha4W+p8srGBsIZBISNeaGAsESIK4LuaShuolciTXtT7Nsqo123EXmjdHrT7DHQuwKI+jJpvHcz/UrissLs1JD+lFLOE07lkHPDc4KKK6IDUjm/DzsVTlTWdrcn8wUZ7fhUTt7e8UDNHs6bMlnhtVkXEsHS3sbYRsbF9179jufUumXKLKkjLzpTZwni8D6GxnjUn51hQ9Ifb9UOlSlkRq+cqOU+TRQd5aQSdiXy5Ymao719MHBrAhH1aLbi9pk4VO3GGFNy/w54ZY2LRIXZsGMBgFTXzHyzqv1ejeQtOuQZw9xOzt9IZU3WuMKVGGR9D61rsgxbGI1aWGaDlyhMSL9LYyqkmEqVqnAyydAVmhpSxhoXjbDrwE/IRdjJwjlK/6NxUck9g7Ekc9pHrow0OmqH9k6SCd2npXBUybTXPYqwHUjY/KccJsW0Ia2OECGN6KgNWdSfFeAGJBrv2ct78laSyNgIguM+0MNOZQSr6QfSQAAAgEAqkHqwfmEtrlc7hKtvenEf4Dkgt6H33U7MJILNOo9qrn/StDeuuO1snbO2wbd8weJop7gnp29zJGRKYcs/p2T3YjOd9R6aRGLOlT+jEZjP1RMPeuT7W4UFajP34SezYc1MAMeT9wkABEBQyj6s+4CvC2tKJWoirziAvkSPfkYdOc3u9I1LuXHu21tP+Lky3K9KylsbnHDG6vw05GH3HbeXIa6LtxAkXiPp/+r0dABO5NzglHS36uaD4mbQGh2dIzWPm4j8mLrjg911R8XnLPdTgT2EB9mvXksLjWEEq7qzTSdacFG0127O+i4Be3h1+5wG5HM8ST1n5hTOX8tTywF3DJL5HbLNHdDQo/YlT6l/wk6HbnYdcZHviVHi6va3/lFTdhoTEPz5sgDYQp5/0vobiMyIRHSZwzcYmswHumpf6Wql/phff8xigJBDAbGdFgx1Jk2OoOVGNWEchZuzlXyfgQpatnzBcR9CAAJvAfQLPqcHb8jGyBINuoNY/0OsAbsQDDzSjOLkBEBVgBTVZbykcik2n7kBQFeNj8zAUeLQCnQcEGIGY7OkPoxaAHBGKh4+e5Wymz0fryKTJ9io78qLHTmc6xs/ep4UwlO4Ee/e9p7cGb2pOl98jGFCWUklqyzeksBTOQcfKZBPV5dYap4m6nrw59XYpVbV9yPRJ/yMhE= downhill@downhill.homelinux.net diff --git a/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub new file mode 100644 index 00000000..a1fcba83 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/files/ssh/sur5r@samsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAABAEApDTX05FmMS1ArryWL6MmgcQeRFRU6E4Rgg+cPTeBuHCtBnnUoCUw7lhD2OICHIzQnfyMQasJOHH/4PnsrAxyO1Lm4KtK3zsdSdA5auunxAy0n7PZwaRKDTXCgpfXvi7ZAlzA+Mq/OjqtltfqdJgToYKxWoehwmltlwibuU1fke2v85VcTbCQRAttc6+0Y+3fToyTWecZM+X0uCsz1B5s07CLrMddo3lPVAlhYStSCbHflsM6C+NQAbxlsjkVFavii7WDYMYOd5FU0jIJt2Fy6u7Lx0ubY6hgGsP+mDOCCaRGA0JdjvWctBruj227CLswtAnYIFxvPi82R/okfx2X4YPtbqUPyLaUbr0G93g+raJEr/uXbour+wRd0TewOLq4VstwOsDfj9pm0wMFyIbsY2y97k6UZc0TE5pu3USGyW9/ainy5zD4TK4Al8lMkDHil6eItlud66KDZ4p5n5gzwuBj+ZOpOcBD5ZqLqDKst3YlHx6EuA1ddObBTrfy/nGphYYhWl1rbJ9+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 diff --git a/contrib/examples/nico/conf/type/__nico_afs/manifest b/contrib/examples/nico/conf/type/__nico_afs/manifest new file mode 100755 index 00000000..7b4cc493 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_afs/manifest @@ -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 . +# +# + + +__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 diff --git a/contrib/examples/nico/conf/type/__nico_afs/singleton b/contrib/examples/nico/conf/type/__nico_afs/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/hostname b/contrib/examples/nico/conf/type/__nico_desktop/files/hostname new file mode 100644 index 00000000..a4df6242 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/files/hostname @@ -0,0 +1 @@ +scheibe diff --git a/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/files/slim-preseed @@ -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 diff --git a/contrib/examples/nico/conf/type/__nico_desktop/manifest b/contrib/examples/nico/conf/type/__nico_desktop/manifest new file mode 100755 index 00000000..7fbbe70f --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/manifest @@ -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 . +# +# + +# +# 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 diff --git a/contrib/examples/nico/conf/type/__nico_desktop/parameter/required b/contrib/examples/nico/conf/type/__nico_desktop/parameter/required new file mode 100644 index 00000000..ecd88aee --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_desktop/parameter/required @@ -0,0 +1 @@ +hostname diff --git a/contrib/examples/nico/conf/type/__nico_desktop/singleton b/contrib/examples/nico/conf/type/__nico_desktop/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/files/slim-preseed @@ -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 diff --git a/contrib/examples/nico/conf/type/__nico_mpd/manifest b/contrib/examples/nico/conf/type/__nico_mpd/manifest new file mode 100644 index 00000000..d339bdf3 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/manifest @@ -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 . +# +# + +__package mpd --state installed + +require="__package/mpd" __file /etc/mpd.conf --source "$__type/files/mpd.conf" diff --git a/contrib/examples/nico/conf/type/__nico_mpd/parameter/required b/contrib/examples/nico/conf/type/__nico_mpd/parameter/required new file mode 100644 index 00000000..ecd88aee --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_mpd/parameter/required @@ -0,0 +1 @@ +hostname diff --git a/contrib/examples/nico/conf/type/__nico_mpd/singleton b/contrib/examples/nico/conf/type/__nico_mpd/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 new file mode 100644 index 00000000..2a92eade --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-eth0 @@ -0,0 +1,6 @@ +# generated by cdist +auto lo eth0 + +iface lo inet loopback + +iface eth0 inet dhcp diff --git a/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 new file mode 100644 index 00000000..49508eb2 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/files/interfaces-wlan0 @@ -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 diff --git a/contrib/examples/nico/conf/type/__nico_network/manifest b/contrib/examples/nico/conf/type/__nico_network/manifest new file mode 100755 index 00000000..012c47f7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/manifest @@ -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 . +# +# + +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 diff --git a/contrib/examples/nico/conf/type/__nico_network/parameter/required b/contrib/examples/nico/conf/type/__nico_network/parameter/required new file mode 100644 index 00000000..b529896a --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_network/parameter/required @@ -0,0 +1 @@ +interface diff --git a/contrib/examples/nico/conf/type/__nico_network/singleton b/contrib/examples/nico/conf/type/__nico_network/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed b/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed new file mode 100644 index 00000000..01448d74 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_nfs_client/files/slim-preseed @@ -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 diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/manifest b/contrib/examples/nico/conf/type/__nico_nfs_client/manifest new file mode 100755 index 00000000..ed1a872b --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_nfs_client/manifest @@ -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 . +# +# + +__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 diff --git a/contrib/examples/nico/conf/type/__nico_nfs_client/singleton b/contrib/examples/nico/conf/type/__nico_nfs_client/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_notebook/manifest b/contrib/examples/nico/conf/type/__nico_notebook/manifest new file mode 100755 index 00000000..7b010230 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_notebook/manifest @@ -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 . +# +# + +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 diff --git a/contrib/examples/nico/conf/type/__nico_notebook/singleton b/contrib/examples/nico/conf/type/__nico_notebook/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_packages/manifest b/contrib/examples/nico/conf/type/__nico_packages/manifest new file mode 100755 index 00000000..a1e663f7 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_packages/manifest @@ -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 . +# +# + +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 diff --git a/contrib/examples/nico/conf/type/__nico_packages/singleton b/contrib/examples/nico/conf/type/__nico_packages/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico b/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico new file mode 100644 index 00000000..d904c319 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/files/sudo-nico @@ -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 diff --git a/contrib/examples/nico/conf/type/__nico_sudo/manifest b/contrib/examples/nico/conf/type/__nico_sudo/manifest new file mode 100755 index 00000000..59315313 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/manifest @@ -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 . +# +# + +destination=/etc/sudoers.d/nico +source="$__type/files/sudo-nico" + +require="__package/sudo" __file "$destination" --source "$source" --mode 0440 + +__package sudo --state installed diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode b/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode new file mode 100644 index 00000000..74792abf --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/parameter/gencode @@ -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 . +# +# +# 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) +# +# + diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest b/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest new file mode 100644 index 00000000..c696eda6 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_sudo/parameter/manifest @@ -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 . +# +# +# 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) +# +# + diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/optional b/contrib/examples/nico/conf/type/__nico_sudo/parameter/optional new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/parameter/required b/contrib/examples/nico/conf/type/__nico_sudo/parameter/required new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_sudo/singleton b/contrib/examples/nico/conf/type/__nico_sudo/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico b/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico new file mode 100644 index 00000000..8d6d7c82 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/files/99-apt-nico @@ -0,0 +1,2 @@ +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "1"; diff --git a/contrib/examples/nico/conf/type/__nico_tee/files/hostname b/contrib/examples/nico/conf/type/__nico_tee/files/hostname new file mode 100644 index 00000000..a4df6242 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/files/hostname @@ -0,0 +1 @@ +scheibe diff --git a/contrib/examples/nico/conf/type/__nico_tee/manifest b/contrib/examples/nico/conf/type/__nico_tee/manifest new file mode 100755 index 00000000..4c614027 --- /dev/null +++ b/contrib/examples/nico/conf/type/__nico_tee/manifest @@ -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 . +# +# + + + +__package unattended-upgrades --state installed + +__file /etc/apt/apt.conf.d/99-apt-nico \ + --source "$__type/files/99-apt-nico" \ + --mode 0644 diff --git a/contrib/examples/nico/conf/type/__nico_tee/singleton b/contrib/examples/nico/conf/type/__nico_tee/singleton new file mode 100644 index 00000000..e69de29b diff --git a/contrib/types_pending_inclusion/__package_zypper/README b/contrib/types_pending_inclusion/__package_zypper/README new file mode 100644 index 00000000..1e073e3f --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/README @@ -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 :-) diff --git a/contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version b/contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version new file mode 100755 index 00000000..0e078f68 --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/explorer/pkg_version @@ -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 . +# +# +# 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 diff --git a/contrib/types_pending_inclusion/__package_zypper/gencode-remote b/contrib/types_pending_inclusion/__package_zypper/gencode-remote new file mode 100755 index 00000000..2d1112d3 --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/gencode-remote @@ -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 . +# +# +# 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 diff --git a/contrib/types_pending_inclusion/__package_zypper/man.text b/contrib/types_pending_inclusion/__package_zypper/man.text new file mode 100644 index 00000000..3a4f1026 --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/man.text @@ -0,0 +1,52 @@ +cdist-type__package_zypper(7) +========================== +Franky Van Liedekerke + + +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). diff --git a/contrib/types_pending_inclusion/__package_zypper/parameter/optional b/contrib/types_pending_inclusion/__package_zypper/parameter/optional new file mode 100644 index 00000000..f121bdbf --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/parameter/optional @@ -0,0 +1 @@ +name diff --git a/contrib/types_pending_inclusion/__package_zypper/parameter/required b/contrib/types_pending_inclusion/__package_zypper/parameter/required new file mode 100644 index 00000000..ff72b5c7 --- /dev/null +++ b/contrib/types_pending_inclusion/__package_zypper/parameter/required @@ -0,0 +1 @@ +state diff --git a/doc/changelog b/doc/changelog index 876a4f43..82ae4b95 100644 --- a/doc/changelog +++ b/doc/changelog @@ -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ó) diff --git a/doc/dev/lastchanges b/doc/dev/lastchanges new file mode 100755 index 00000000..8679372a --- /dev/null +++ b/doc/dev/lastchanges @@ -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 . +# +# +# Show the lastest changes from this (upcoming) release +# + +awk '/^$/ { exit } { print $0 } END { print "-----" }' < "${0%/*}/../changelog" diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index c4da3df3..8670c8f1 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -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) diff --git a/doc/dev/todo/steven b/doc/dev/todo/steven index 5f91a198..e69de29b 100644 --- a/doc/dev/todo/steven +++ b/doc/dev/todo/steven @@ -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 ... - diff --git a/doc/dev/todo/steven-from-nico b/doc/dev/todo/steven-from-nico deleted file mode 100644 index 21c8fb52..00000000 --- a/doc/dev/todo/steven-from-nico +++ /dev/null @@ -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 :-) - diff --git a/doc/gfx/cdist-automated-inverted.png b/doc/gfx/cdist-automated-inverted.png new file mode 100644 index 00000000..a33c4b6e Binary files /dev/null and b/doc/gfx/cdist-automated-inverted.png differ diff --git a/doc/gfx/cdist-logo-inverted.png b/doc/gfx/cdist-logo-inverted.png new file mode 100644 index 00000000..d4a00c6e Binary files /dev/null and b/doc/gfx/cdist-logo-inverted.png differ diff --git a/doc/man/man1/cdist-manifest-run.text b/doc/man/man1/cdist-manifest-run.text index d483b29b..8cd6b513 100644 --- a/doc/man/man1/cdist-manifest-run.text +++ b/doc/man/man1/cdist-manifest-run.text @@ -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) diff --git a/doc/man/man7/cdist-manifest.text b/doc/man/man7/cdist-manifest.text index 04f1c56c..43dd2b6a 100644 --- a/doc/man/man7/cdist-manifest.text +++ b/doc/man/man7/cdist-manifest.text @@ -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) diff --git a/doc/speeches/2011-05-20_cosin.tex b/doc/speeches/2011-05-20_cosin.tex new file mode 100644 index 00000000..f60a660a --- /dev/null +++ b/doc/speeches/2011-05-20_cosin.tex @@ -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}