2018-05-21 14:04:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
2019-01-26 03:37:56 +00:00
|
|
|
ANSIBLE_ROLES_PATH=../ ansible-playbook setup.yml
|
|
|
|
|
2018-05-21 14:04:43 +00:00
|
|
|
# Test pause module when no tty and non-interactive. This is to prevent playbooks
|
|
|
|
# from hanging in cron and Tower jobs.
|
|
|
|
/usr/bin/env bash << EOF
|
2019-01-26 03:37:56 +00:00
|
|
|
ansible-playbook test-pause-no-tty.yml 2>&1 | \
|
2018-05-21 14:04:43 +00:00
|
|
|
grep '\[WARNING\]: Not waiting for response to prompt as stdin is not interactive' && {
|
|
|
|
echo 'Successfully skipped pause in no TTY mode' >&2
|
|
|
|
exit 0
|
|
|
|
} || {
|
|
|
|
echo 'Failed to skip pause module' >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2018-07-06 21:19:55 +00:00
|
|
|
# Test redirecting stdout
|
|
|
|
# Issue #41717
|
2019-01-26 03:37:56 +00:00
|
|
|
ansible-playbook pause-3.yml > /dev/null \
|
2018-07-06 21:19:55 +00:00
|
|
|
&& echo "Successfully redirected stdout" \
|
|
|
|
|| echo "Failure when attempting to redirect stdout"
|
|
|
|
|
2018-05-21 14:04:43 +00:00
|
|
|
# Test pause with seconds and minutes specified
|
2019-01-26 03:37:56 +00:00
|
|
|
ansible-playbook test-pause.yml "$@"
|
2018-05-21 14:04:43 +00:00
|
|
|
|
|
|
|
# Interactively test pause
|
2019-01-26 03:37:56 +00:00
|
|
|
python test-pause.py "$@"
|