From a9e5b2c33691d275ca591be6b9ad035995803fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 29 Dec 2025 15:09:07 +0200 Subject: [PATCH] Use new arguments and fix Init playbook location in Infra command --- src/commands/infra.sh | 17 ++++++++++++++--- wx | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) 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