1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/handlers/test_handlers.yml
2019-03-12 00:00:32 -07:00

47 lines
1.1 KiB
YAML

---
- name: run handlers
hosts: A
gather_facts: False
roles:
- { role: test_handlers_meta, tags: ['scenario1'] }
- name: verify final handler was run
hosts: A
gather_facts: False
tasks:
- name: verify handler2 ran
assert:
that:
- "not hostvars[inventory_hostname]['handler1_called']"
- "'handler2_called' in hostvars[inventory_hostname]"
tags: ['scenario1']
- name: verify listening handlers
hosts: A
gather_facts: False
tasks:
- name: notify some handlers
command: echo foo
notify:
- notify_listen
post_tasks:
- name: assert all defined handlers ran without error
assert:
that:
- "notify_listen_ran_1 is defined"
- "notify_listen_ran_2 is defined"
handlers:
- name: first listening handler has a name
set_fact:
notify_listen_ran_1: True
listen: notify_listen
# second listening handler does not
- set_fact:
notify_listen_ran_2: True
listen: notify_listen
- name: test handlers
hosts: testgroup
gather_facts: False
roles:
- { role: test_handlers }