blob: f05dfdc11012d5234bb909519800c3f4d4ec55e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env bash
set -eux
export ANSIBLE_TIMEOUT=1
export ANSIBLE_CONNECTION_PLUGINS=./fake_connectors
# use fake connectors that raise errors at different stages
ansible-playbook test_with_bad_plugins.yml -i inventory -v "$@"
unset ANSIBLE_CONNECTION_PLUGINS
ansible-playbook test_cannot_connect.yml -i inventory -v "$@"
if ansible-playbook test_base_cannot_connect.yml -i inventory -v "$@"; then
echo "Playbook intended to fail succeeded. Connection succeeded to nonexistent host"
exit 99
else
echo "Connection to nonexistent hosts failed without using ignore_unreachable. Success!"
fi
if ansible-playbook test_base_loop_cannot_connect.yml -i inventory -v "$@" > out.txt; then
echo "Playbook intended to fail succeeded. Connection succeeded to nonexistent host"
exit 1
fi
grep out.txt -e 'ignored=1' | grep 'unreachable=2' | grep 'ok=1'
|