diff options
-rw-r--r-- | TODO.md | 3 | ||||
-rwxr-xr-x | bin/dependencies | 6 | ||||
-rwxr-xr-x | bin/deploy | 38 | ||||
-rwxr-xr-x | bin/provision | 26 | ||||
-rw-r--r-- | files/patches/README.md | 4 | ||||
-rw-r--r-- | files/patches/puppet-stack-level-trusty.patch | 15 |
6 files changed, 75 insertions, 17 deletions
@@ -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. |