Debian Codegraph @

test/integration/targets/limit_inventory/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux
4
5 trap 'echo "Host pattern limit test failed"' ERR
6
7 # https://github.com/ansible/ansible/issues/61964
8
9 # These tests should return all hosts
10 ansible -i hosts.yml all --limit ,, --list-hosts | tee out ; grep -q 'hosts (3)' out
11 ansible -i hosts.yml ,, --list-hosts | tee out ; grep -q 'hosts (3)' out
12 ansible -i hosts.yml , --list-hosts | tee out ; grep -q 'hosts (3)' out
13 ansible -i hosts.yml all --limit , --list-hosts | tee out ; grep -q 'hosts (3)' out
14 ansible -i hosts.yml all --limit '' --list-hosts | tee out ; grep -q 'hosts (3)' out
15
16
17 # Only one host
18 ansible -i hosts.yml all --limit ,,host1 --list-hosts | tee out ; grep -q 'hosts (1)' out
19 ansible -i hosts.yml ,,host1 --list-hosts | tee out ; grep -q 'hosts (1)' out
20
21 ansible -i hosts.yml all --limit host1,, --list-hosts | tee out ; grep -q 'hosts (1)' out
22 ansible -i hosts.yml host1,, --list-hosts | tee out ; grep -q 'hosts (1)' out
23
24
25 # Only two hosts
26 ansible -i hosts.yml all --limit host1,,host3 --list-hosts | tee out ; grep -q 'hosts (2)' out
27 ansible -i hosts.yml host1,,host3 --list-hosts | tee out ; grep -q 'hosts (2)' out
28
29 ansible -i hosts.yml all --limit 'host1, , ,host3' --list-hosts | tee out ; grep -q 'hosts (2)' out
30 ansible -i hosts.yml 'host1, , ,host3' --list-hosts | tee out ; grep -q 'hosts (2)' out
31