From: Silvio Rhatto Date: Fri, 25 Sep 2015 23:24:03 +0000 (-0300) Subject: Deploy: custom facts and YAML X-Git-Tag: 0.2.4~284 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=d33c4fa00732dc024dc7f28a986891507c544e3f;p=hydra.git Deploy: custom facts and YAML --- diff --git a/share/hydra/deploy b/share/hydra/deploy index 3705a9e..6b91480 100755 --- a/share/hydra/deploy +++ b/share/hydra/deploy @@ -39,14 +39,30 @@ for node in $NODES; do # Sync repository to server # Exclude eventual keys and version control files - rsync -CrltDv --no-perms --exclude=keys --delete --rsync-path "sudo rsync" $HYDRA_FOLDER/puppet/ $node:/etc/puppet/ + rsync -CrltDv --no-perms --exclude=keys --exclude=hiera --delete --rsync-path "sudo rsync" $HYDRA_FOLDER/puppet/ $node:/etc/puppet/ + + # Setup custom facts + FQDN="`$HYDRA_CONNECT $node facter fqdn`" + DOMAIN="`echo $FQDN | cut -d . -f 2-`" + ROLE="`grep "^nodo::role: " domain/$DOMAIN/$FQDN.yaml | cut -d ' ' -f 2 | sed -e "s/'//g" -e 's/"//g'`" + LOCATION="`grep "^nodo::location: " domain/$DOMAIN/$FQDN.yaml | cut -d ' ' -f 2 | sed -e "s/'//g" -e 's/"//g'`" + + # Check for manifest + if [ ! -e "$HYDRA_FOLDER/puppet/manifests/nodes/$FQDN.pp" ]; then + echo "Not found: $HYDRA_FOLDER/puppet/manifests/nodes/$FQDN.pp" + exit 1 + fi + + # Copy needed hiera YAMLs + # TODO # Run puppet $HYDRA_CONNECT $node <