Debian Codegraph @

test/integration/targets/set_fact/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux
4
5 ansible-playbook -i inventory set_fact.yml "$@"
6
7 MYTMPDIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
8 trap 'rm -rf "${MYTMPDIR}"' EXIT
9
10 # ensure we can incrementally set fact via loopi, injection or not
11 ANSIBLE_INJECT_FACT_VARS=0 ansible-playbook -i inventory incremental.yml
12 ANSIBLE_INJECT_FACT_VARS=1 ansible-playbook -i inventory incremental.yml
13
14 # ensure we dont have spurious warnings do to clean_facts
15 ansible-playbook -i inventory nowarn_clean_facts.yml | grep '[WARNING]: Removed restricted key from module data: ansible_ssh_common_args' && exit 1
16
17 # test cached feature
18 export ANSIBLE_CACHE_PLUGIN=jsonfile ANSIBLE_CACHE_PLUGIN_CONNECTION="${MYTMPDIR}" ANSIBLE_CACHE_PLUGIN_PREFIX=prefix_
19 ansible-playbook -i inventory "$@" set_fact_cached_1.yml
20 ansible-playbook -i inventory "$@" set_fact_cached_2.yml
21
22 # check contents of the fact cache directory before flushing it
23 if [[ "$(find "${MYTMPDIR}" -type f)" != $MYTMPDIR/prefix_* ]]; then
24 echo "Unexpected cache file"
25 exit 1
26 fi
27
28 ansible-playbook -i inventory --flush-cache "$@" set_fact_no_cache.yml
29
30 # Test boolean conversions in set_fact
31 ansible-playbook -v set_fact_bool_conv_jinja2_native.yml
32
33 # Test parsing of values when using an empty string as a key
34 ansible-playbook -i inventory set_fact_empty_str_key.yml
35
36 # https://github.com/ansible/ansible/issues/21088
37 ansible-playbook -i inventory "$@" set_fact_auto_unsafe.yml
38
39 ansible-playbook -i inventory "$@" set_fact_ansible_vars.yml 2>&1 | tee test_set_fact_ansible_vars.out
40 test "$(grep -E -c 'is reserved for internal use only.' test_set_fact_ansible_vars.out)" = 1