diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-27 10:00:01 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-27 10:00:01 -0300 |
commit | 77226079874216a22563cff089fcc4b2211bf30d (patch) | |
tree | 59c525125fb53ba97d7dab1bf731106f2371675c /share/hydra/newnode | |
parent | 62ebbcf86b038fd01891a154c203f58ad434d89e (diff) | |
download | hydra-77226079874216a22563cff089fcc4b2211bf30d.tar.gz hydra-77226079874216a22563cff089fcc4b2211bf30d.tar.bz2 |
Ansible support at init and newnode
Diffstat (limited to 'share/hydra/newnode')
-rwxr-xr-x | share/hydra/newnode | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/share/hydra/newnode b/share/hydra/newnode index 96861f6..78cd6cb 100755 --- a/share/hydra/newnode +++ b/share/hydra/newnode @@ -51,10 +51,12 @@ if [ ! -z "$ROLE" ]; then fi # Set YAML template -if [ -e "$HYDRA_FOLDER/config/puppet/nodo.example.org.yaml" ]; then +if [ -e "$HYDRA_FOLDER/puppet/nodo.example.org.yaml" ]; then + YAML="$HYDRA_FOLDER/puppet/nodo.example.org.yaml" +elif [ -e "$HYDRA_FOLDER/config/puppet/nodo.example.org.yaml" ]; then YAML="$HYDRA_FOLDER/config/puppet/nodo.example.org.yaml" else - YAML="$APP_BASE/share/config/puppet/nodo.example.org.yaml" + YAML="$APP_BASE/share/puppet/nodo.example.org.yaml" fi # Copy YAML template @@ -67,10 +69,12 @@ if [ ! -z "$ROLE" ]; then fi # Set secret YAML template -if [ -e "$HYDRA_FOLDER/config/puppet/secrets/nodo.example.org.yaml" ]; then +if [ -e "$HYDRA_FOLDER/puppet/secrets/nodo.example.org.yaml" ]; then + YAML="$HYDRA_FOLDER/puppet/secrets/nodo.example.org.yaml" +elif [ -e "$HYDRA_FOLDER/config/puppet/secrets/nodo.example.org.yaml" ]; then YAML="$HYDRA_FOLDER/config/puppet/secrets/nodo.example.org.yaml" else - YAML="$APP_BASE/share/config/puppet/secrets/nodo.example.org.yaml" + YAML="$APP_BASE/share/puppet/secrets/nodo.example.org.yaml" fi # Setup secret YAML template @@ -90,12 +94,19 @@ echo "" >> $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yaml keyringer $HYDRA decrypt nodes/$NODE/gpg/key.passwd | \ hydra fluxo eyaml $NODE encrypt --stdin -o block -q -l nodo::subsystem::backup::password >> $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yaml -echo "" >> $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yam +echo "" >> $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yaml # Add Borg passphrase into secret node config keyringer $HYDRA decrypt nodes/$NODE/borg/key.passwd | \ hydra fluxo eyaml $NODE encrypt --stdin -o block -q -l nodo::subsystem::backup::borg::password >> $HYDRA_FOLDER/puppet/config/secrets/node/$NODE.yaml +# Ansible config +if [ -e "$HYDRA_FOLDER/ansible/inventories/production/hosts" ]; then + echo "$NODE" >> $HYDRA_FOLDER/ansible/inventories/production/hosts +elif [ -e "$HYDRA_FOLDER/ansible/inventories/hosts" ]; then + echo "$NODE" >> $HYDRA_FOLDER/ansible/inventories/hosts +fi + # Add to git ( cd $HYDRA_FOLDER/puppet @@ -105,4 +116,7 @@ hydra fluxo eyaml $NODE encrypt --stdin -o block -q -l nodo::subsystem::backup:: #if [ -e 'manifests/site.pp' ]; then # git add manifests/site.pp #fi + + cd $HYDRA_FOLDER/ansible + git add . ) |