diff --git a/bin/cdist-config b/bin/cdist-config index f7fb5ac0..88e3068f 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -398,7 +398,7 @@ __cdist_type_has_explorer() __cdist_type_explorer_pushed() { [ -f "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" ] \ - && grep -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" + && grep -x -q "$1" "${__cdist_out_type_dir}/${__cdist_name_type_explorer_pushed}" } __cdist_type_explorer_pushed_add() diff --git a/bin/cdist-deploy-stdin-to b/bin/cdist-deploy-stdin-to new file mode 100755 index 00000000..391dd431 --- /dev/null +++ b/bin/cdist-deploy-stdin-to @@ -0,0 +1,36 @@ +#!/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 . +# +# +# Use stdin as the manifest to deploy on the given host. +# + +. cdist-config +[ $# -eq 1 ] || __cdist_usage "" +set -eu + +__cdist_target_host="$1" +shift + +cat >> "$__cdist_tmp_file" + +chmod +x "$__cdist_tmp_file" + +export __cdist_manifest_init="$__cdist_tmp_file" +cdist-deploy-to "$__cdist_target_host" diff --git a/conf/manifest/init.sample b/conf/manifest/init.sample index b683e02f..fca959e2 100755 --- a/conf/manifest/init.sample +++ b/conf/manifest/init.sample @@ -50,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/__apt_ppa/manifest b/conf/type/__apt_ppa/manifest index d5df9e23..5aa84931 100755 --- a/conf/type/__apt_ppa/manifest +++ b/conf/type/__apt_ppa/manifest @@ -27,3 +27,4 @@ require="__package/python-software-properties" \ --source "$__type/files/remove-apt-repository" \ --mode 0755 +require="$__self" __apt_update_index diff --git a/conf/type/__apt_update_index/gencode-remote b/conf/type/__apt_update_index/gencode-remote new file mode 100755 index 00000000..e66ff7a3 --- /dev/null +++ b/conf/type/__apt_update_index/gencode-remote @@ -0,0 +1,26 @@ +#!/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 . +# + +# run 'apt-get update' if anything in /etc/apt is newer then /var/lib/apt/lists +cat << DONE +if find /etc/apt -cnewer /var/lib/apt/lists | grep . > /dev/null; then + apt-get update || apt-get update +fi +DONE diff --git a/conf/type/__apt_update_index/man.text b/conf/type/__apt_update_index/man.text new file mode 100644 index 00000000..778af508 --- /dev/null +++ b/conf/type/__apt_update_index/man.text @@ -0,0 +1,41 @@ +cdist-type__apt_update_index(7) +=============================== +Steven Armstrong + + +NAME +---- +cdist-type__apt_update_index - update apt's package index + + +DESCRIPTION +----------- +This cdist type runs apt-get update whenever any apt sources have changed. + + +REQUIRED PARAMETERS +------------------- +None. + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__apt_update_index +-------------------------------------------------------------------------------- + + +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/__apt_update_index/singleton b/conf/type/__apt_update_index/singleton new file mode 100644 index 00000000..e69de29b diff --git a/conf/type/__package_apt/notes.txt b/conf/type/__package_apt/notes.txt new file mode 100644 index 00000000..4b89f9b3 --- /dev/null +++ b/conf/type/__package_apt/notes.txt @@ -0,0 +1,3 @@ +# All you ever wanted to know about apt/apt-get +http://wiki.ubuntuusers.de/apt-get + 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/doc/dev/logs/2011-07-01.type-gencode b/doc/dev/logs/2011-07-01.type-gencode new file mode 100644 index 00000000..cafa8ef2 --- /dev/null +++ b/doc/dev/logs/2011-07-01.type-gencode @@ -0,0 +1,9 @@ +when all objects of a type are applied, then run the types gencode-{local,remote} scripts + +-------------------------------------------------------------------------------- + +__mein_type/ + type/ # executed when all objects of this type have been applied + gencode-local + gencode-remote + diff --git a/doc/dev/logs/2011-07-01.type-global-explorers b/doc/dev/logs/2011-07-01.type-global-explorers new file mode 100644 index 00000000..302c2866 --- /dev/null +++ b/doc/dev/logs/2011-07-01.type-global-explorers @@ -0,0 +1,22 @@ +types can contribute global explorers +-------------------------------------------------------------------------------- + +__mein_type/ + global/ + explorer/ + status-von-foo + anderer + +$out/explorer/ + hostname + os + ... + __mein_type/ + status-von-foo + anderer + + +todos: +- cdist scans types for global/explorer's +- when executing explorers, create the types namespace folder before running type gobal explorers + diff --git a/doc/man/man1/cdist-deploy-stdin-to.text b/doc/man/man1/cdist-deploy-stdin-to.text new file mode 100644 index 00000000..14f19478 --- /dev/null +++ b/doc/man/man1/cdist-deploy-stdin-to.text @@ -0,0 +1,30 @@ +cdist-deploy-stdin-to(1) +======================== +Steven Armstrong + + +NAME +---- +cdist-deploy-stdin-to - Deploy the configuration given on stdin to host + + +SYNOPSIS +-------- +echo "__file /tmp/whatever" | cdist-deploy-stdin-to HOSTNAME + + +DESCRIPTION +----------- +Use stdin as the manifest for cdist-deploy-to. + + +SEE ALSO +-------- +- cdist(7) +- cdist-deploy-to(1) + + +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).