Template run_once for handlers (#54030)

Fixes #27237
This commit is contained in:
Martin Krizek
2019-03-20 14:46:19 +01:00
committed by GitHub
parent d1a688b1d7
commit 0e28ab4528
4 changed files with 28 additions and 7 deletions

View File

@@ -75,3 +75,10 @@ set -e
# https://github.com/ansible/ansible/issues/47287
[ "$(ansible-playbook test_handlers_including_task.yml -i ../../inventory -v "$@" | egrep -o 'failed=[0-9]+')" = "failed=0" ]
# https://github.com/ansible/ansible/issues/27237
set +e
result="$(ansible-playbook test_handlers_template_run_once.yml -i inventory.handlers "$@" 2>&1)"
set -e
grep -q "handler A" <<< "$result"
grep -q "handler B" <<< "$result"

View File

@@ -0,0 +1,12 @@
- hosts: A,B
gather_facts: no
tasks:
- debug:
changed_when: true
notify:
- handler
handlers:
- name: handler
debug:
msg: "handler {{ inventory_hostname }}"
run_once: "{{ testvar | default(False) }}"