mirror of https://github.com/ansible/ansible.git
parent
24593f2ffb
commit
907ff2f26c
@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- Add new meta task end_host - https://github.com/ansible/ansible/issues/40904
|
@ -0,0 +1 @@
|
|||||||
|
shippable/posix/group3
|
@ -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
|
@ -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 }}"
|
@ -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 }}"
|
Loading…
Reference in New Issue