1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

tests: check that handlers are able to use 'include'

This commit is contained in:
Pierre-Louis Bonicoli 2015-07-16 03:54:12 +02:00 committed by Michael Scherer
parent 2ac12432ef
commit 3edac76e1b
5 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,2 @@
- name: test handler
debug: msg="handler called"

View file

@ -0,0 +1 @@
- include: handlers.yml

View file

@ -0,0 +1,4 @@
- name: 'main task'
debug: msg='main task'
changed_when: True
notify: test handler

View file

@ -34,3 +34,9 @@ ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario
# Forcing false in play, which overrides command line
[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags force_false_in_play --force-handlers \
| egrep -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_B" ]
[ "$(ansible-playbook test_handlers_include.yml -i ../../inventory -v "$@" --tags playbook_include_handlers \
| egrep -o 'RUNNING HANDLER \[.*?]')" = "RUNNING HANDLER [test handler]" ]
[ "$(ansible-playbook test_handlers_include.yml -i ../../inventory -v "$@" --tags role_include_handlers \
| egrep -o 'RUNNING HANDLER \[test_handlers_include : .*?]')" = "RUNNING HANDLER [test_handlers_include : test handler]" ]

View file

@ -0,0 +1,14 @@
- name: verify that play can include handler
hosts: testhost
tasks:
- debug: msg="main task"
changed_when: True
notify: test handler
tags: ['playbook_include_handlers']
handlers:
- include: handlers.yml
- name: verify that role can include handler
hosts: testhost
roles:
- { role: test_handlers_include, tags: ['role_include_handlers'] }