Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fix(core): Adopt to executor changes
[csit.git]
/
resources
/
libraries
/
bash
/
function
/
ansible.sh
diff --git
a/resources/libraries/bash/function/ansible.sh
b/resources/libraries/bash/function/ansible.sh
index
3beca3f
..
64508bd
100644
(file)
--- 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.
# 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
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
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' \
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!"
--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.
# 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
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
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' \
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!"
--limit "$(echo ${hosts[@]//\"})" \
--tags "$(echo $@)" || die "Failed to run ansible on host!"
popd || die "Popd failed!"