aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hydra/deploy24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/hydra/deploy b/lib/hydra/deploy
index 05705f6..b97897d 100644
--- a/lib/hydra/deploy
+++ b/lib/hydra/deploy
@@ -19,7 +19,7 @@ function hydra_deploy_setup {
FQDN="`$DEPLOY_COMMAND cat /etc/hostname`"
DEPLOY_DEST="$FQDN:"
COPY_PATH="$RSYNC_PATH"
- PUPPET_MANIFEST="/etc/puppet/manifests/nodes/$FQDN.pp"
+ hydra_deploy_set_manifest
else
echo "No folder specified."
exit 1
@@ -31,7 +31,7 @@ function hydra_deploy_setup {
DEPLOY_COMMAND="$SUDO chroot $FOLDER"
DEPLOY_OPTS="$HYDRA_FOLDER/puppet/ $FOLDER/etc/puppet/"
DEPLOY_DEST="$FOLDER"
- PUPPET_MANIFEST="/etc/puppet/manifests/nodes/$FQDN.pp"
+ hydra_deploy_set_manifest
if [ ! -d "$FOLDER"]; then
echo "folder not found: $FOLDER"
@@ -52,7 +52,7 @@ function hydra_deploy_setup {
DEPLOY_COMMAND="$SUDO"
FQDN="`cat /etc/hostname`"
PUPPET_OPTS="--confdir=$HYDRA_FOLDER/puppet --modulepath=$HYDRA_FOLDER/puppet/modules"
- PUPPET_MANIFEST="$HYDRA_FOLDER/puppet/manifests/nodes/$FQDN.pp"
+ hydra_deploy_set_manifest $HYDRA_FOLDER
fi
# Common parameters
@@ -77,6 +77,24 @@ function hydra_deploy_setup {
fi
}
+# Manifest
+function hydra_deploy_set_manifest {
+ local prefix="$1"
+
+ if [ -z "$prefix" ]; then
+ prefix="/etc"
+ fi
+
+ if [ -e "$HYDRA_FOLDER/puppet/manifests/nodes/$FQDN.pp" ]; then
+ PUPPET_MANIFEST="$prefix/puppet/manifests/nodes/$FQDN.pp"
+ elif [ -e "$HYDRA_FOLDER/puppet/manifests/nodes/default.pp" ]; then
+ PUPPET_MANIFEST="$prefix/puppet/manifests/nodes/default.pp"
+ else
+ echo "no manifest found for $FQDN"
+ exit
+ fi
+}
+
# Return a simple parameter from an YAML file
function hydra_yaml_param {
local param="$1"