aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dependencies6
-rwxr-xr-xbin/deploy38
-rwxr-xr-xbin/provision26
3 files changed, 53 insertions, 17 deletions
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