aboutsummaryrefslogtreecommitdiff
path: root/bin/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'bin/deploy')
-rwxr-xr-xbin/deploy38
1 files changed, 38 insertions, 0 deletions
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"