Debian Codegraph @

test/integration/targets/module_utils/module_utils_envvar.yml

raw
1 - hosts: testhost
2 gather_facts: no
3 tasks:
4 - name: Use a specially crafted module to see if things were imported correctly
5 test:
6 register: result
7
8 - name: Check that these are all loaded from playbook dir's module_utils
9 assert:
10 that:
11 - 'result["abcdefgh"] == "abcdefgh"'
12 - 'result["bar0"] == "bar0"'
13 - 'result["bar1"] == "bar1"'
14 - 'result["bar2"] == "bar2"'
15 - 'result["baz1"] == "baz1"'
16 - 'result["baz2"] == "baz2"'
17 - 'result["foo0"] == "foo0"'
18 - 'result["foo1"] == "foo1"'
19 - 'result["foo2"] == "foo2"'
20 - 'result["qux1"] == "qux1"'
21 - 'result["qux2"] == ["qux2:quux", "qux2:quuz"]'
22 - 'result["spam1"] == "spam1"'
23 - 'result["spam2"] == "spam2"'
24 - 'result["spam3"] == "spam3"'
25 - 'result["spam4"] == "spam4"'
26 - 'result["spam5"] == ["spam5:bacon", "spam5:eggs"]'
27 - 'result["spam6"] == ["spam6:bacon", "spam6:eggs"]'
28 - 'result["spam7"] == ["spam7:bacon", "spam7:eggs"]'
29 - 'result["spam8"] == ["spam8:bacon", "spam8:eggs"]'
30
31 # Test that overriding something in module_utils with something in the local library works
32 - name: Test that playbook dir's module_utils overrides facts.py
33 test_override:
34 register: result
35
36 - name: Make sure the we used the local ansible_release.py, not the one shipped with ansible
37 assert:
38 that:
39 - 'result["data"] == "overridden ansible_release.py"'
40
41 - name: Test that importing something from the module_utils in the env_vars works
42 test_env_override:
43 register: result
44
45 - name: Make sure we used the module_utils from the env_var for these
46 assert:
47 that:
48 # Override of shipped module_utils
49 - 'result["json_utils"] == "overridden json_utils"'
50 # Only i nthe env vars directory
51 - 'result["mork"] == "mork"'