diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2016-10-02 15:42:56 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2016-10-02 15:42:56 -0300 |
commit | 0f570e5647e3781d1bc64669652fe8e05d3ad019 (patch) | |
tree | f8a269e65daf34854c78166bc43a3cc7dcee9dcf /share | |
parent | 0ff931322da2c30f649d4c6782dc44d89dd8553f (diff) | |
download | hydra-0f570e5647e3781d1bc64669652fe8e05d3ad019.tar.gz hydra-0f570e5647e3781d1bc64669652fe8e05d3ad019.tar.bz2 |
Newnode: role support
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/newnode | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/share/hydra/newnode b/share/hydra/newnode index cfd521c..dabc27c 100755 --- a/share/hydra/newnode +++ b/share/hydra/newnode @@ -23,7 +23,7 @@ hydra_config_load # Parameters BASENAME="`basename $0`" NODE="$1" -CLASS="$2" +ROLE="$2" DOMAIN="`cat $HYDRA_FOLDER/config/domain 2> /dev/null`" # Check if node was given by fqdn or just hostname @@ -33,7 +33,7 @@ fi # Check configuration and parameters if [ -z "$NODE" ]; then - echo "usage: hydra $BASENAME <node> [class]" + echo "usage: hydra $BASENAME <node> [role]" exit 1 elif [ ! -e "$HYDRA_FOLDER/config/domain" ]; then echo "fatal: please configure your domain at $HYDRA_FOLDER/config/domain" @@ -44,9 +44,9 @@ elif [ -e "$HYDRA_FOLDER/puppet/config/node/$NODE.yaml" ]; then fi # Provision config -if [ ! -z "$CLASS" ]; then - if [ -e "$APP_BASE/share/config/provision/$CLASS.conf" ]; then - cp $APP_BASE/share/config/provision/$CLASS.conf $HYDRA_FOLDER/config/provision/$NODE.conf +if [ ! -z "$ROLE" ]; then + if [ -e "$APP_BASE/share/config/provision/$ROLE.conf" ]; then + cp $APP_BASE/share/config/provision/$ROLE.conf $HYDRA_FOLDER/config/provision/$NODE.conf fi fi @@ -61,6 +61,11 @@ fi mkdir -p $HYDRA_FOLDER/puppet/config/node cp $YAML $HYDRA_FOLDER/puppet/config/node/$NODE.yaml +# Fix role configuration +if [ ! -z "$ROLE" ]; then + sed -i -e "s/nodo::role: 'virtual'/nodo::role: '$ROLE'" $HYDRA_FOLDER/puppet/config/node/$NODE.yaml +fi + # Set secret YAML template if [ -e "$HYDRA_FOLDER/config/puppet/secrets/nodo.example.org.yaml" ]; then YAML="$HYDRA_FOLDER/config/puppet/secrets/nodo.example.org.yaml" |