summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/handlers/test_listening_handlers.yml
blob: f4c3cae4b29d6eb43b9621e538def57b80b208a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: verify listening handlers
  hosts: A
  gather_facts: False
  tasks:
    - name: notify some handlers
      command: echo foo
      notify:
        - notify_listen

    - name: notify another handler
      debug:
      changed_when: true
      notify: another_listen

    - name: nofity another handler 2
      debug:
      changed_when: true
      notify: another_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"
        - "another_listen_ran is true"
  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

    - set_fact:
        another_listen_ran: '{{ False if another_listen_ran is defined else True }}'
      listen: another_listen