summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/hydra/newnode9
1 files changed, 6 insertions, 3 deletions
diff --git a/share/hydra/newnode b/share/hydra/newnode
index 5fdd264..b375b8a 100755
--- a/share/hydra/newnode
+++ b/share/hydra/newnode
@@ -65,7 +65,7 @@ mkdir -p $HYDRA_FOLDER/puppet/hiera/node
cp $YAML $HYDRA_FOLDER/puppet/hiera/node/$NODE.$DOMAIN.yaml
# Setup secret YAML template
-mkdir $HYDRA_FOLDER/puppet/hiera/secrets/node
+mkdir -p $HYDRA_FOLDER/puppet/hiera/secrets/node
echo "---" > $HYDRA_FOLDER/puppet/hiera/secrets/node/$NODE.$DOMAIN.yaml
# Copy node template
@@ -79,6 +79,9 @@ sed -i -e "s/example.org/$DOMAIN/g" $HYDRA_FOLDER/puppet/manifests/nodes/$NODE.$
# Add to git
(
cd $HYDRA_FOLDER/puppet
- git add manifests/site.pp manifests/nodes/$NODE.pp hiera/node/$NODE.$DOMAIN.yaml
- git add manifests/site.pp manifests/nodes/$NODE.pp hiera/secrets/node/$NODE.$DOMAIN.yaml
+ git add manifests/nodes/$NODE.pp hiera/node/$NODE.$DOMAIN.yaml hiera/secrets/node/$NODE.$DOMAIN.yaml
+
+ if [ -e 'manifests/site.pp' ]; then
+ git add manifests/site.pp
+ fi
)