Debian Codegraph @

test/integration/targets/gathering_facts/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux
4
5 # ensure task vars reflect facts during loops
6 ansible-playbook ansible_facts_as_task_vars.yml -i ../../inventory "$@"
7
8 #ANSIBLE_CACHE_PLUGINS=cache_plugins/ ANSIBLE_CACHE_PLUGIN=none ansible-playbook test_gathering_facts.yml -i inventory -v "$@"
9 ansible-playbook test_gathering_facts.yml -i inventory -e output_dir="$OUTPUT_DIR" -v "$@"
10 #ANSIBLE_CACHE_PLUGIN=base ansible-playbook test_gathering_facts.yml -i inventory -v "$@"
11
12 ANSIBLE_GATHERING=smart ansible-playbook test_run_once.yml -i inventory -v "$@"
13
14 # ensure clean_facts is working properly
15 ansible-playbook test_prevent_injection.yml -i inventory -v "$@"
16
17 # ensure fact merging is working properly
18 ansible-playbook verify_merge_facts.yml -v "$@" -e 'ansible_facts_parallel=False'
19
20 # ensure we dont clobber facts in loop
21 ansible-playbook prevent_clobbering.yml -v "$@"
22
23 # ensure we dont fail module on bad subset
24 ansible-playbook verify_subset.yml "$@"
25
26 # ensure we can set defaults for the action plugin and facts module
27 ansible-playbook test_module_defaults.yml "$@" --tags default_fact_module
28 ANSIBLE_FACTS_MODULES='ansible.legacy.setup' ansible-playbook test_module_defaults.yml "$@" --tags custom_fact_module
29
30 ansible-playbook test_module_defaults.yml "$@" --tags networking
31
32 # test gather_facts action templates module_defaults for different module name
33 ansible-playbook test_module_defaults.yml "$@" --tags templating
34
35 # test it works by default
36 ANSIBLE_FACTS_MODULES='ansible.legacy.slow' ansible -m gather_facts localhost --playbook-dir ./ "$@"
37
38 # test that gather_facts will timeout parallel modules that dont support gather_timeout when using gather_Timeout
39 ANSIBLE_FACTS_MODULES='ansible.legacy.slow' ANSIBLE_TASK_TIMEOUT=5 ansible -m gather_facts localhost --playbook-dir ./ -a 'gather_timeout=1 parallel=true' "$@" 2>&1 |grep 'Timeout exceeded'
40
41 # test that gather_facts parallel w/o timing out
42 ANSIBLE_FACTS_MODULES='ansible.legacy.slow' ansible -m gather_facts localhost --playbook-dir ./ -a 'gather_timeout=10 parallel=true' "$@" 2>&1 |grep 'Timeout exceeded' && exit 1
43
44
45 # test parallelism
46 ANSIBLE_FACTS_MODULES='dummy1,dummy2,dummy3' ansible -m gather_facts localhost --playbook-dir ./ -a 'gather_timeout=30 parallel=true' "$@" 2>&1
47
48 # ensure we error out on bad network os
49 ANSIBLE_FACTS_MODULES='smart' ansible -m gather_facts localhost -e 'ansible_network_os="N/A"' "$@" 2>&1 | grep "No fact modules available"
50
51 # ensure we warn on setup + network OS
52 ANSIBLE_FACTS_MODULES='smart, setup' ansible -m gather_facts localhost -e 'ansible_network_os="N/A"' "$@" 2>&1 | grep "Detected 'setup' module and a network OS is set"
53
54 # ensure run setup when smart+ and no network OS
55 ANSIBLE_FACTS_MODULES='smart, facts_one' ansible-playbook smart_added.yml -i inventory "$@"
56
57 rm "${OUTPUT_DIR}/canary.txt"