Debian Codegraph @

test/integration/targets/delegate_to/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux
4
5 platform="$(uname)"
6
7 function setup() {
8 if [[ "${platform}" == "FreeBSD" ]] || [[ "${platform}" == "Darwin" ]]; then
9 ifconfig lo0
10
11 existing=$(ifconfig lo0 | grep '^[[:blank:]]inet 127\.0\.0\. ' || true)
12
13 echo "${existing}"
14
15 for i in 3 4 254; do
16 ip="127.0.0.${i}"
17
18 if [[ "${existing}" != *"${ip}"* ]]; then
19 ifconfig lo0 alias "${ip}" up
20 fi
21 done
22
23 ifconfig lo0
24 fi
25 }
26
27 function teardown() {
28 if [[ "${platform}" == "FreeBSD" ]] || [[ "${platform}" == "Darwin" ]]; then
29 for i in 3 4 254; do
30 ip="127.0.0.${i}"
31
32 if [[ "${existing}" != *"${ip}"* ]]; then
33 ifconfig lo0 -alias "${ip}"
34 fi
35 done
36
37 ifconfig lo0
38 fi
39 }
40
41 setup
42
43 trap teardown EXIT
44
45 ANSIBLE_SSH_ARGS='-C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null' \
46 ANSIBLE_HOST_KEY_CHECKING=false ansible-playbook test_delegate_to.yml -i inventory -v "$@"
47
48 ansible-playbook test_delegate_to_loop_randomness.yml -i inventory -v "$@"
49
50 ansible-playbook delegate_and_nolog.yml -i inventory -v "$@"
51
52 ansible-playbook delegate_facts_block.yml -i inventory -v "$@"
53
54 ansible-playbook test_delegate_to_loop_caching.yml -i inventory -v "$@"
55
56 # ensure we are using correct settings when delegating
57 ANSIBLE_TIMEOUT=3 ansible-playbook delegate_vars_handling.yml -i inventory -i delegate_vars_inventory -v | tee out
58 if grep '{{ hostip }}' out; then
59 echo 'Callback displayed the ansible_host template instead of the rendered value.'
60 exit 1
61 fi
62
63 ansible-playbook has_hostvars.yml -i inventory -v "$@"
64
65 # test ansible_x_interpreter
66 # python
67 source virtualenv.sh
68 (
69 cd "${OUTPUT_DIR}"/venv/bin
70 ln -s python firstpython
71 ln -s python secondpython
72 )
73 ansible-playbook verify_interpreter.yml -i inventory_interpreters -v "$@"
74 ansible-playbook discovery_applied.yml -i inventory -v "$@"
75 ansible-playbook resolve_vars.yml -i inventory -v "$@"
76 ansible-playbook test_delegate_to_lookup_context.yml -i inventory -v "$@"
77 ansible-playbook delegate_local_from_root.yml -i inventory -v "$@" -e 'ansible_user=root'
78 ansible-playbook delegate_with_fact_from_delegate_host.yml "$@"
79 ansible-playbook delegate_facts_loop.yml -i inventory -v "$@"
80 ansible-playbook test_random_delegate_to_with_loop.yml -i inventory -v "$@"
81 ansible-playbook test_delegated_async.yml -v "$@"
82
83 # Run playbook multiple times to ensure there are no false-negatives
84 for i in $(seq 0 10); do ansible-playbook test_random_delegate_to_without_loop.yml -i inventory -v "$@"; done;