mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
committed by
Brian Coca
parent
24593f2ffb
commit
907ff2f26c
1
test/integration/targets/meta_tasks/aliases
Normal file
1
test/integration/targets/meta_tasks/aliases
Normal file
@@ -0,0 +1 @@
|
||||
shippable/posix/group3
|
||||
23
test/integration/targets/meta_tasks/runme.sh
Executable file
23
test/integration/targets/meta_tasks/runme.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
# test end_host meta task, with when conditional
|
||||
for test_strategy in linear free; do
|
||||
out="$(ansible-playbook test_end_host.yml -i ../../inventory -e test_strategy=$test_strategy -vv "$@")"
|
||||
|
||||
grep -q "META: end_host conditional evaluated to false, continuing execution for testhost" <<< "$out"
|
||||
grep -q "META: ending play for testhost2" <<< "$out"
|
||||
grep -q "play not ended for testhost" <<< "$out"
|
||||
grep -qv "play not ended for testhost2" <<< "$out"
|
||||
done
|
||||
|
||||
# test end_host meta task, on all hosts
|
||||
for test_strategy in linear free; do
|
||||
out="$(ansible-playbook test_end_host_all.yml -i ../../inventory -e test_strategy=$test_strategy -vv "$@")"
|
||||
|
||||
grep -q "META: ending play for testhost" <<< "$out"
|
||||
grep -q "META: ending play for testhost2" <<< "$out"
|
||||
grep -qv "play not ended for testhost" <<< "$out"
|
||||
grep -qv "play not ended for testhost2" <<< "$out"
|
||||
done
|
||||
14
test/integration/targets/meta_tasks/test_end_host.yml
Normal file
14
test/integration/targets/meta_tasks/test_end_host.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
- name: "Testing end_host with strategy={{ test_strategy | default('linear') }}"
|
||||
hosts:
|
||||
- testhost
|
||||
- testhost2
|
||||
gather_facts: no
|
||||
strategy: "{{ test_strategy | default('linear') }}"
|
||||
tasks:
|
||||
- debug:
|
||||
|
||||
- meta: end_host
|
||||
when: "host_var_role_name == 'role2'" # end play for testhost2, see test/integration/inventory
|
||||
|
||||
- debug:
|
||||
msg: "play not ended for {{ inventory_hostname }}"
|
||||
13
test/integration/targets/meta_tasks/test_end_host_all.yml
Normal file
13
test/integration/targets/meta_tasks/test_end_host_all.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
- name: "Testing end_host all hosts with strategy={{ test_strategy | default('linear') }}"
|
||||
hosts:
|
||||
- testhost
|
||||
- testhost2
|
||||
gather_facts: no
|
||||
strategy: "{{ test_strategy | default('linear') }}"
|
||||
tasks:
|
||||
- debug:
|
||||
|
||||
- meta: end_host
|
||||
|
||||
- debug:
|
||||
msg: "play not ended {{ inventory_hostname }}"
|
||||
Reference in New Issue
Block a user