#!/bin/bash
-## Run Puppet locally using puppet apply
+## Run Puppet locally using puppet_apply
git submodule update --init
-/usr/bin/puppet apply `pwd`/manifests/site.pp
+/usr/local/sbin/puppet_apply `pwd`/manifests/site.pp
## Log status of the Puppet run
if [ $? -eq 0 ]
--- /dev/null
+#!/bin/bash
+
+lockfile=/var/run/puppet-apply.lock
+path=`dirname $0`
+path=`cd $path/..; pwd`
+
+if [ $(id -u) -gt 0 ]; then
+ echo "You must be root to run this script." >&2
+ exit 2
+fi
+
+if (set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then
+ trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
+
+ puppet apply "$@"
+
+ rm -f "$lockfile"
+ trap - INT TERM EXIT
+else
+ echo "Failed to acquire lockfile: $lockfile." >&2
+ echo "Held by $(cat $lockfile 2>/dev/null)" >&2
+ exit 1
+fi
git reset --hard origin/$branch
git submodule update --init
-puppet apply --test manifests/site.pp
+puppet_apply --test manifests/site.pp
}
cron { 'puppet-apply':
ensure => present,
- command => "cd $base_installation::puppet_code_path ; puppet apply $base_installation::puppet_code_path/manifests/site.pp",
+ command => "cd $base_installation::puppet_code_path ; puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
user => root,
minute => '*/20'
}
cron { 'puppet-apply-reboot':
ensure => present,
- command => "cd $base_installation::puppet_code_path ; puppet apply $base_installation::puppet_code_path/manifests/site.pp",
+ command => "cd $base_installation::puppet_code_path ; puppet_apply $base_installation::puppet_code_path/manifests/site.pp",
user => root,
special => "reboot"
}
source => "puppet:///modules/base_installation/scripts/report_print.rb"
}
+ file { '/usr/local/sbin/puppet_apply':
+ mode => "0755",
+ ensure => present,
+ source => "puppet:///modules/base_installation/scripts/puppet_apply",
+ }
+
unless empty(find_file($password_seed)) {
$ldap_password = generate_password(24, $password_seed, "ldap")
$ssha_ldap_seed = generate_password(5, $password_seed, "ldap_seed")