diff --git a/src/commands/infra.sh b/src/commands/infra.sh index f0b3f24..8b7d31c 100644 --- a/src/commands/infra.sh +++ b/src/commands/infra.sh @@ -54,6 +54,8 @@ wx-infra(){ then wxi-header "Init" h3 + hostname=${args['hostname']} + if [[ -z ${args['3']} ]] then tags=init @@ -61,15 +63,24 @@ wx-infra(){ tags=${args['3']} fi - ansible-playbook $INFRA_VAULT playbooks/init.yml -t $tags --limit "${args['limit']}" + ansible-playbook $INFRA_VAULT init.yml --tags $tags --limit "$hostname" elif [[ ${args['2']} == "manager" ]] then + if [[ -z ${args['hostname']} ]] + then + hostname="any" + else + hostname=${args['hostname']} + fi + operation=${args['operation']} + wxi-header "Manager" h3 - ansible-playbook $INFRA_VAULT manager.yml --extra-vars "${args['extra-vars']}" + ansible-playbook $INFRA_VAULT manager.yml --tags $operation --extra-vars "host=$hostname operation=$operation" else wxi-header "Playbooks" h3 + hostname=${args['hostname']} tags=${args['2']} - ansible-playbook $INFRA_VAULT playbooks.yml -t $tags --limit "${args['limit']}" + ansible-playbook $INFRA_VAULT playbooks.yml --tags $tags --limit "$hostname" fi cd "$OLDPWD" fi diff --git a/wx b/wx index 21164d5..a582438 100755 --- a/wx +++ b/wx @@ -326,6 +326,8 @@ wx-infra(){ then wxi-header "Init" h3 + hostname=${args['hostname']} + if [[ -z ${args['3']} ]] then tags=init @@ -333,15 +335,24 @@ wx-infra(){ tags=${args['3']} fi - ansible-playbook $INFRA_VAULT playbooks/init.yml -t $tags --limit "${args['limit']}" + ansible-playbook $INFRA_VAULT init.yml --tags $tags --limit "$hostname" elif [[ ${args['2']} == "manager" ]] then + if [[ -z ${args['hostname']} ]] + then + hostname="any" + else + hostname=${args['hostname']} + fi + operation=${args['operation']} + wxi-header "Manager" h3 - ansible-playbook $INFRA_VAULT manager.yml --extra-vars "${args['extra-vars']}" + ansible-playbook $INFRA_VAULT manager.yml --tags $operation --extra-vars "host=$hostname operation=$operation" else wxi-header "Playbooks" h3 + hostname=${args['hostname']} tags=${args['2']} - ansible-playbook $INFRA_VAULT playbooks.yml -t $tags --limit "${args['limit']}" + ansible-playbook $INFRA_VAULT playbooks.yml --tags $tags --limit "$hostname" fi cd "$OLDPWD" fi