aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-10-26 19:00:41 -0200
committerSilvio Rhatto <rhatto@riseup.net>2015-10-26 19:00:41 -0200
commit2ab0d39c3b742110660f7b0445bf32bc24df4fb5 (patch)
tree55f5b9874a828751c1f58940c5944fcf54b29b8b /lib
parentba1d1dc14096166b24cd5b472688e036137d5673 (diff)
downloadhydra-2ab0d39c3b742110660f7b0445bf32bc24df4fb5.tar.gz
hydra-2ab0d39c3b742110660f7b0445bf32bc24df4fb5.tar.bz2
Deploy: support for default node definition
Diffstat (limited to 'lib')
-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"