aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-10-20 13:53:25 -0200
committerSilvio Rhatto <rhatto@riseup.net>2015-10-20 13:53:25 -0200
commit49c44668c835013a88e067e0af588d0005fe2d01 (patch)
treeec8c044891f2b1cb807c8d7590e08685347b5597
parent91477be1db80bd38ccc03ab38487e69dcad30b86 (diff)
downloadpuppet-bootstrap-49c44668c835013a88e067e0af588d0005fe2d01.tar.gz
puppet-bootstrap-49c44668c835013a88e067e0af588d0005fe2d01.tar.bz2
Patches, deployment code and TODO update
-rw-r--r--TODO.md3
-rwxr-xr-xbin/dependencies6
-rwxr-xr-xbin/deploy38
-rwxr-xr-xbin/provision26
-rw-r--r--files/patches/README.md4
-rw-r--r--files/patches/puppet-stack-level-trusty.patch15
6 files changed, 75 insertions, 17 deletions
diff --git a/TODO.md b/TODO.md
index 8fed92c..5151b13 100644
--- a/TODO.md
+++ b/TODO.md
@@ -22,6 +22,9 @@ High priority
- http://andrewbunday.co.uk/2012/12/04/masterless-puppet-wrapper/
- http://semicomplete.com/presentations/puppet-at-loggly/puppet-at-loggly.pdf.html
- https://github.com/jordansissel/puppet-examples/tree/master/masterless
+ - hooks:
+ - storeconfigs warning patch
+ - https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1313595
- sshd:
- https://stribika.github.io/2015/01/04/secure-secure-shell.html
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774711#60
diff --git a/bin/dependencies b/bin/dependencies
index d77e5f6..507145b 100755
--- a/bin/dependencies
+++ b/bin/dependencies
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Simple shell provisioner for Vagrant instances.
+# Puppet bootstrap dependencies.
#
# Install a package, thanks to the Hydra Suite.
@@ -13,13 +13,13 @@ function provision_package {
if [ "$?" == "1" ]; then
echo "Installing package $1..."
- DEBIAN_FRONTEND=noninteractive $sudo apt-get install $1 -y
+ DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $1 -y
fi
}
# Set sudo config
if [ "`whoami`" != 'root' ]; then
- sudo="sudo"
+ SUDO="sudo"
fi
# Ensure basic packages are installed.
diff --git a/bin/deploy b/bin/deploy
new file mode 100755
index 0000000..8d296e9
--- /dev/null
+++ b/bin/deploy
@@ -0,0 +1,38 @@
+#!/bin/bash
+#
+# Deploy configuration using puppet.
+#
+
+# Parameters
+DIRNAME="`dirname $0`"
+BASEDIR="$DIRNAME/.."
+DEPLOY_DEPENDENCIES="puppet ruby-sqlite3 ruby-activerecord ruby-activerecord-deprecated-finders"
+
+# Load dependencies
+source $DIRNAME/dependencies
+
+# Determine hostname
+if [ ! -z "$1" ]; then
+ FQDN="$1"
+else
+ FQDN="`cat /etc/hostname`"
+fi
+
+# Check for manifest
+PUPPET_MANIFEST="$BASEDIR/puppet/manifests/nodes/$FQDN.pp"
+if [ ! -e "$PUPPET_MANIFEST" ]; then
+ echo "file not found: $PUPPET_MANIFEST"
+ exit 1
+fi
+
+# Install dependencies
+source $DIRNAME/dependencies
+
+# Ensure additional dependencies are installed.
+for package in $DEPLOY_DEPENDENCIES; do
+ provision_package $package
+done
+
+# Run puppet apply
+PUPPET_OPTS="--confdir=$BASEDIR/puppet --modulepath=$BASEDIR/puppet/modules"
+$SUDO LC_ALL=C puppet apply $PUPPET_OPTS $PUPPET_MANIFEST"
diff --git a/bin/provision b/bin/provision
index 8473d53..16f102f 100755
--- a/bin/provision
+++ b/bin/provision
@@ -3,16 +3,14 @@
# Simple shell provisioner for Vagrant instances.
#
-# Set sudo config
-if [ "`whoami`" != 'root' ]; then
- sudo="sudo"
-fi
+# Parameters
+DIRNAME="`dirname $0`"
-# Ensure the system is updated.
-$sudo apt-get update && DEBIAN_FRONTEND=noninteractive $sudo apt-get dist-upgrade -y && $sudo apt-get autoremove -y && $sudo apt-get clean
+# Load dependencies
+source $DIRNAME/dependencies
-# Install dependencies
-source /vagrant/puppet/bin/dependencies
+# Ensure the system is updated.
+$SUDO apt-get update && DEBIAN_FRONTEND=noninteractive $SUDO apt-get dist-upgrade -y && $SUDO apt-get autoremove -y && $SUDO apt-get clean
# Ensure additional dependencies are installed.
for package in usbutils; do
@@ -24,14 +22,14 @@ for package in ruby-sqlite3 ruby-activerecord ruby-activerecord-deprecated-finde
provision_package $package
done
-# Link hiera configuration.
+# Link hiera configuration if needed.
if [ ! -h "/etc/puppet/hiera.yaml" ]; then
- $sudo rm -f /etc/puppet/hiera.yaml
- $sudo ln -s /vagrant/puppet/hiera/hiera.yaml /etc/puppet/hiera.yaml
+ $SUDO rm -f /etc/puppet/hiera.yaml
+ $SUDO ln -s $DIRNAME/../hiera/hiera.yaml /etc/puppet/hiera.yaml
fi
-# Link puppet configuration.
+# Link puppet configuration if needed.
if [ ! -h "/etc/puppet/puppet.conf" ]; then
- $sudo rm -f /etc/puppet/puppet.conf
- $sudo ln -s /vagrant/puppet/puppet.conf /etc/puppet/puppet.conf
+ $SUDO rm -f /etc/puppet/puppet.conf
+ $SUDO ln -s $DIRNAME/../puppet.conf /etc/puppet/puppet.conf
fi
diff --git a/files/patches/README.md b/files/patches/README.md
new file mode 100644
index 0000000..649bdf6
--- /dev/null
+++ b/files/patches/README.md
@@ -0,0 +1,4 @@
+Patches
+=======
+
+* [Puppet master fails with 'stack level too deep' error when storeconfigs = true](https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1313595): puppet-stack-level-trusty.patch.
diff --git a/files/patches/puppet-stack-level-trusty.patch b/files/patches/puppet-stack-level-trusty.patch
new file mode 100644
index 0000000..3521dd9
--- /dev/null
+++ b/files/patches/puppet-stack-level-trusty.patch
@@ -0,0 +1,15 @@
+--- resource.rb.orig 2015-10-19 17:19:13.500193213 -0200
++++ resource.rb 2015-10-19 17:19:58.972194943 -0200
+@@ -84,7 +84,11 @@
+ end
+
+ def [](param)
+- super || parameter(param)
++ if param == 'id'
++ super
++ else
++ super || parameter(param)
++ end
+ end
+
+ # Make sure this resource is equivalent to the provided Parser resource.