diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/lookup_inventory_hostnames/main.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream.tar.xz ansible-core-upstream.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/lookup_inventory_hostnames/main.yml')
-rw-r--r-- | test/integration/targets/lookup_inventory_hostnames/main.yml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/integration/targets/lookup_inventory_hostnames/main.yml b/test/integration/targets/lookup_inventory_hostnames/main.yml new file mode 100644 index 0000000..4b822e3 --- /dev/null +++ b/test/integration/targets/lookup_inventory_hostnames/main.yml @@ -0,0 +1,23 @@ +--- +- hosts: localhost + gather_facts: no + tasks: + - set_fact: + hosts_a: "{{ lookup('inventory_hostnames', 'group01', wantlist=true) }}" + hosts_b: "{{ groups['group01'] }}" + exclude: "{{ lookup('inventory_hostnames', 'group01:!test03', wantlist=true) }}" + intersect: "{{ lookup('inventory_hostnames', 'group01:&group02', wantlist=true) }}" + nogroup: "{{ lookup('inventory_hostnames', 'nogroup01', wantlist=true) }}" + doesnotexist: "{{ lookup('inventory_hostnames', 'doesnotexist', wantlist=true) }}" + all: "{{ lookup('inventory_hostnames', 'all', wantlist=true) }}" + from_patterns: "{{ lookup('inventory_hostnames', 't?s?03', wantlist=True) }}" + + - assert: + that: + - hosts_a == hosts_b + - "'test03' not in exclude" + - intersect == ['test03', 'test04'] + - nogroup == ['nogroup01'] + - doesnotexist == [] + - all|length == 12 + - from_patterns == ['test03'] |