Debian Codegraph @

test/integration/targets/inventory_constructed/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux -o pipefail
4
5 ansible-inventory -i static_inventory.yml -i constructed.yml --graph | tee out.txt
6
7 grep '@_hostvalue1' out.txt
8 grep '@_item0' out.txt
9 grep '@_key0_value0' out.txt
10 grep '@prefix_hostvalue1' out.txt
11 grep '@prefix_item0' out.txt
12 grep '@prefix_key0_value0' out.txt
13 grep '@separatorhostvalue1' out.txt
14 grep '@separatoritem0' out.txt
15 grep '@separatorkey0separatorvalue0' out.txt
16
17 ansible-inventory -i static_inventory.yml -i no_leading_separator_constructed.yml --graph | tee out.txt
18
19 grep '@hostvalue1' out.txt
20 grep '@item0' out.txt
21 grep '@key0_value0' out.txt
22 grep '@key0separatorvalue0' out.txt
23 grep '@prefix_hostvalue1' out.txt
24 grep '@prefix_item0' out.txt
25 grep '@prefix_key0_value0' out.txt
26
27 # keyed group with default value for key's value empty (dict)
28 ansible-inventory -i tag_inventory.yml -i keyed_group_default_value.yml --graph | tee out.txt
29
30 grep '@tag_name_host0' out.txt
31 grep '@tag_environment_test' out.txt
32 grep '@tag_status_running' out.txt
33 grep '@tag_type_running' out.txt
34
35 grep '@without_trailing_name_host0' out.txt
36 grep '@without_trailing_environment_test' out.txt
37 grep '@without_trailing_status' out.txt
38 grep '@without_trailing_type' out.txt
39
40 # keyed group with default value for key's value empty (list)
41 ansible-inventory -i tag_inventory.yml -i keyed_group_list_default_value.yml --graph | tee out.txt
42
43 grep '@host_db' out.txt
44 grep '@host_web' out.txt
45 grep '@host_storage' out.txt
46 grep '@host_None' out.txt && exit 1
47 grep '@empty_list_test_default_value' out.txt && exit 1
48
49 # keyed group with default value for key's value empty (str)
50 ansible-inventory -i tag_inventory.yml -i keyed_group_str_default_value.yml --graph | tee out.txt
51
52 grep '@host_fedora' out.txt
53 grep '@none_test_default_value' out.txt
54 grep '@empty_test_default_value' out.txt
55
56 # keyed group with 'trailing_separator' set to 'False' for key's value empty
57 ansible-inventory -i tag_inventory.yml -i keyed_group_trailing_separator.yml --graph | tee out.txt
58
59 grep '@tag_name_host0' out.txt
60 grep '@tag_environment_test' out.txt
61 grep '@tag_status' out.txt
62
63
64 # test using use_vars_plugins
65 ansible-inventory -i invs/1/one.yml -i invs/2/constructed.yml --graph | tee out.txt
66
67 grep '@c_lola' out.txt
68 grep '@c_group4testing' out.txt