]> gitweb.fluxo.info Git - puppet-bootstrap.git/commitdiff
Patches, deployment code and TODO update
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 20 Oct 2015 15:53:25 +0000 (13:53 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 20 Oct 2015 15:53:25 +0000 (13:53 -0200)
TODO.md
bin/dependencies
bin/deploy [new file with mode: 0755]
bin/provision
files/patches/README.md [new file with mode: 0644]
files/patches/puppet-stack-level-trusty.patch [new file with mode: 0644]

diff --git a/TODO.md b/TODO.md
index 8fed92cbbe7210b75c95036be546ca249dcc8591..5151b1387b6993f67feb7d255d42b02394265bb9 100644 (file)
--- 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
index d77e5f6a2e315546b8198a21bee4689997dac2b1..507145ba4004518bf86aafc279138dc0a67b9f32 100755 (executable)
@@ -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 (executable)
index 0000000..8d296e9
--- /dev/null
@@ -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"
index 8473d53255261bf6838ee5d73c98974b1339fa0f..16f102f1e1ea8e7a0ea11815dbedfc41b24c2c23 100755 (executable)
@@ -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 (file)
index 0000000..649bdf6
--- /dev/null
@@ -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 (file)
index 0000000..3521dd9
--- /dev/null
@@ -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.