diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-20 19:16:56 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-20 19:16:56 -0300 |
commit | 91581c1ed778b5dccd472201cc14be2eaca6b1a4 (patch) | |
tree | ea2478456f94bd58f7bf74df8acc0529d396a71d | |
parent | 7aa82be2bd031fc10a5c787f641a881a4157d00a (diff) | |
download | hydra-91581c1ed778b5dccd472201cc14be2eaca6b1a4.tar.gz hydra-91581c1ed778b5dccd472201cc14be2eaca6b1a4.tar.bz2 |
Local deployment enhancements
-rwxr-xr-x | share/hydractl/deploy | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/share/hydractl/deploy b/share/hydractl/deploy index d61519e..7bedb1e 100755 --- a/share/hydractl/deploy +++ b/share/hydractl/deploy @@ -22,9 +22,36 @@ hydra_config_load # Parameters MANIFEST="`facter fqdn`.pp" +FOLDER="$1" -# Run puppet -if [ -e "$HYDRA_FOLDER/puppet/manifests/nodes/$MANIFEST" ]; then - sudo puppet apply --confdir=$HYDRA_FOLDER/puppet \ - --modulepath=$HYDRA_FOLDER/modules $HYDRA_FOLDER/puppet/manifests/nodes/$MANIFEST +# Set sudo config +local sudo device rsync +if [ "`whoami`" != 'root' ]; then + sudo="sudo" +fi + +# Dispatch +if [ ! -z "$FOLDER" ]; then + if [ ! -d "$FOLDER"]; then + echo "folder not found: $FOLDER" + exit 1 + fi + + echo "Deploying to $FOLDER..." + + # Saner defaults + $sudo mkdir -p $FOLDER/etc/puppet + $sudo chown -R root. $FOLDER/etc/puppet + $sudo chmod -R 640 $FOLDER/etc/puppet + + # Sync repository to server + # Exclude eventual keys and version control files + $sudo rsync -CrltDv --no-perms --exclude=keys --delete $HYDRA_FOLDER/puppet/ $FOLDER/etc/puppet/ + + # Run puppet + $sudo chroot $FOLDER puppet apply /etc/puppet/manifests/nodes/$MANIFEST +elif [ -e "$HYDRA_FOLDER/puppet/manifests/nodes/$MANIFEST" ]; then + # Run puppet + $sudo puppet apply --confdir=$HYDRA_FOLDER/puppet \ + --modulepath=$HYDRA_FOLDER/modules $HYDRA_FOLDER/puppet/manifests/nodes/$MANIFEST fi |