function ansible_hosts () {
+
# Run ansible playbook on hosts in working topology file. Ansible scope is
# determined by tags passed as parameters to this function.
#
set -exuo pipefail
if ! installed sshpass; then
- sudo apt-get update -y || die "apt-get update failed!"
- sudo apt-get install -y sshpass || die "Install sshpass failed!"
+ die "Please install sshpass!"
fi
if ! installed ansible-playbook; then
die "Failed to read hosts from working topology!"
}
pushd "${TOOLS_DIR}"/testbed-setup/ansible || die "Pushd failed!"
- ansible-playbook \
+ ANSIBLE_STDOUT_CALLBACK=yaml ansible-playbook \
--vault-password-file=vault_pass \
--extra-vars '@vault.yml' \
--inventory inventories/lf_inventory/hosts site.yaml \
function installed () {
- set -exuo pipefail
-
# Check if the given utility is installed. Fail if not installed.
#
# Arguments:
# - ${1} - Utility to check.
- # Returns:
+ # Returns (implicitly):
# - 0 - If command is installed.
# - 1 - If command is not installed.
+ set -exuo pipefail
+
command -v "${1}"
-}
\ No newline at end of file
+}