Debian Codegraph @

ansible_collections/community/aws/tests/integration/targets/inventory_aws_mq/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eux
4
5 function cleanup() {
6 ansible-playbook playbooks/setup_instance.yml -e "operation=delete" "$@"
7 exit 1
8 }
9
10 trap 'cleanup "${@}"' ERR
11
12 # ensure test config is empty
13 ansible-playbook playbooks/empty_inventory_config.yml "$@"
14
15 export ANSIBLE_INVENTORY_ENABLED="community.aws.aws_mq"
16
17 # test with default inventory file
18 ansible-playbook playbooks/test_invalid_aws_mq_inventory_config.yml "$@"
19
20 export ANSIBLE_INVENTORY=test.aws_mq.yml
21
22 # test empty inventory config
23 ansible-playbook playbooks/test_invalid_aws_mq_inventory_config.yml "$@"
24
25 # delete existing resources
26 ansible-playbook playbooks/setup_instance.yml -e "operation=delete" "$@"
27
28 # generate inventory config and test using it
29 ansible-playbook playbooks/create_inventory_config.yml "$@"
30
31 # test inventory with no hosts
32 ansible-playbook playbooks/test_inventory_no_hosts.yml "$@"
33
34 # create MQ resources
35 ansible-playbook playbooks/setup_instance.yml -e "operation=create" "$@"
36
37 # test inventory populated with MQ instance
38 ansible-playbook playbooks/test_populating_inventory.yml "$@"
39
40 # generate inventory config with constructed features and test using it
41 ansible-playbook playbooks/create_inventory_config.yml -e "template='inventory_with_constructed.j2'" "$@"
42 ansible-playbook playbooks/test_populating_inventory_with_constructed.yml "$@"
43
44 # generate inventory config with hostvars_prefix features and test using it
45 ansible-playbook playbooks/create_inventory_config.yml -e "template='inventory_with_hostvars_prefix_suffix.j2'" -e "inventory_prefix='aws_mq_'" "$@"
46 ansible-playbook playbooks/test_inventory_with_hostvars_prefix_suffix.yml -e "inventory_prefix='aws_mq_'" "$@"
47
48 # generate inventory config with hostvars_suffix features and test using it
49 ansible-playbook playbooks/create_inventory_config.yml -e "template='inventory_with_hostvars_prefix_suffix.j2'" -e "inventory_suffix='_aws_mq'" "$@"
50 ansible-playbook playbooks/test_inventory_with_hostvars_prefix_suffix.yml -e "inventory_suffix='_aws_mq'" "$@"
51
52 # generate inventory config with hostvars_prefix and hostvars_suffix features and test using it
53 ansible-playbook playbooks/create_inventory_config.yml -e "template='inventory_with_hostvars_prefix_suffix.j2'" -e "inventory_prefix='aws_'" -e "inventory_suffix='_mq'" "$@"
54 ansible-playbook playbooks/test_inventory_with_hostvars_prefix_suffix.yml -e "inventory_prefix='aws_'" -e "inventory_suffix='_mq'" "$@"
55
56 # generate inventory config with statuses and test using it
57 ansible-playbook playbooks/create_inventory_config.yml -e '{"inventory_statuses": true}' "$@"
58 ansible-playbook playbooks/test_inventory_no_hosts.yml "$@"
59
60 # generate inventory config with caching and test using it
61 AWS_MQ_CACHE_DIR="aws_mq_cache_dir"
62 rm -rf "${AWS_MQ_CACHE_DIR}"
63 ansible-playbook playbooks/create_inventory_config.yml -e "template='inventory_with_cache.j2'" -e "aws_inventory_cache_dir=$AWS_MQ_CACHE_DIR" "$@"
64 ansible-playbook playbooks/populate_cache.yml "$@"
65 ansible-playbook playbooks/test_inventory_cache.yml "$@"
66 rm -rf "${AWS_MQ_CACHE_DIR}"
67
68 # cleanup inventory config
69 ansible-playbook playbooks/empty_inventory_config.yml "$@"
70
71 ansible-playbook playbooks/setup_instance.yml -e "operation=delete" "$@"
72