diff options
author | Tomas Alexy <tomas.alexy@pantheon.tech> | 2021-04-08 15:50:24 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2021-04-12 05:49:55 +0000 |
commit | 647a693a245ae450756fb3bd9446db856e712812 (patch) | |
tree | 128aa75cf1d9f69c03fbe198071465aa15636b16 /resources/libraries/bash/function/ansible.sh | |
parent | ae5cd8ce30c435a83868ff7e13d88d41594c227c (diff) |
Infra: AWS bootstrap integration
Signed-off-by: Tomas Alexy <tomas.alexy@pantheon.tech>
Change-Id: I254c79201a198ee054851c934167a24e9e8803cb
Diffstat (limited to 'resources/libraries/bash/function/ansible.sh')
-rw-r--r-- | resources/libraries/bash/function/ansible.sh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/resources/libraries/bash/function/ansible.sh b/resources/libraries/bash/function/ansible.sh index 3beca3fba4..64508bda11 100644 --- a/resources/libraries/bash/function/ansible.sh +++ b/resources/libraries/bash/function/ansible.sh @@ -23,9 +23,19 @@ function ansible_adhoc () { # Variable read: # - ${WORKING_TOPOLOGY} - Reserved working topology. # - ${CSIT_DIR} - CSIT main directory, where ansible playbooks are located. + # - ${FLAVOR} - Node flavor string, see common.sh set -exuo pipefail + case "$FLAVOR" in + "aws") + INVENTORY_PATH="cloud_inventory" + ;; + *) + INVENTORY_PATH="lf_inventory" + ;; + esac + if ! installed sshpass; then die "Please install sshpass!" fi @@ -40,7 +50,7 @@ function ansible_adhoc () { ansible-playbook \ --vault-password-file=vault_pass \ --extra-vars '@vault.yml' \ - --inventory inventories/lf_inventory/hosts site.yaml \ + --inventory inventories/$INVENTORY_PATH/hosts site.yaml \ --limit "$(echo ${hosts[@]//\"})" \ --module-name shell \ --args \"$(echo $@)\" || die "Failed to run ansible on host!" @@ -55,9 +65,19 @@ function ansible_playbook () { # Variable read: # - ${WORKING_TOPOLOGY} - Reserved working topology. # - ${CSIT_DIR} - CSIT main directory, where ansible playbooks are located. + # - ${FLAVOR} - Node flavor string, see common.sh set -exuo pipefail + case "$FLAVOR" in + "aws") + INVENTORY_PATH="cloud_inventory" + ;; + *) + INVENTORY_PATH="lf_inventory" + ;; + esac + if ! installed sshpass; then die "Please install sshpass!" fi @@ -72,7 +92,7 @@ function ansible_playbook () { ansible-playbook \ --vault-password-file=vault_pass \ --extra-vars '@vault.yml' \ - --inventory inventories/lf_inventory/hosts site.yaml \ + --inventory inventories/$INVENTORY_PATH/hosts site.yaml \ --limit "$(echo ${hosts[@]//\"})" \ --tags "$(echo $@)" || die "Failed to run ansible on host!" popd || die "Popd failed!" |