2020-05-29 17:00:21 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-05-29 22:45:33 +02:00
|
|
|
set -eux
|
2020-05-29 17:00:21 +02:00
|
|
|
export ANSIBLE_ROLES_PATH=../
|
|
|
|
|
2020-05-29 22:45:33 +02:00
|
|
|
function cleanup {
|
|
|
|
ansible-playbook teardown.yml -i "$INVENTORY_PATH" "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2020-05-29 17:00:21 +02:00
|
|
|
ansible-playbook setup.yml -i "$INVENTORY_PATH" "$@"
|
|
|
|
|
|
|
|
# We need a nonempty file to override key with (empty file gives a
|
|
|
|
# lovely "list index out of range" error)
|
|
|
|
foo=$(mktemp)
|
|
|
|
echo hello > "$foo"
|
|
|
|
|
2020-05-29 22:45:33 +02:00
|
|
|
# We want to ensure that passwords make it to the network connection plugins
|
|
|
|
# because they follow a different path than the rest of the codebase.
|
|
|
|
# In setup.yml, we create a passworded user, and now we connect as that user
|
|
|
|
# to make sure the password we pass here successfully makes it to the plugin.
|
2020-05-29 17:00:21 +02:00
|
|
|
ansible-playbook \
|
|
|
|
-i "$INVENTORY_PATH" \
|
|
|
|
-e ansible_user=atester \
|
|
|
|
-e ansible_password=testymctest \
|
|
|
|
-e ansible_ssh_private_key_file="$foo" \
|
|
|
|
passworded_user.yml
|