ansible/test/integration/targets/handlers/test_templating_in_handlers.yml
Sloane Hertel ec1287ca7e
Fix notifying handlers by using an exact match (#55624)
* Fix notifying handlers by using an exact match rather than a string subset if listen is text rather than a list

* Enforce better type checking for listeners

* Share code for validating handler listeners

* Add test for handlers without names

* Add test for templating in handlers

* Add test for include_role

* Add a couple notes about 'listen' for handlers

* changelog

* Add a test for handlers without names

* Test templating in handlers

* changelog

* Add some tests for include_role

* Add a couple notes about 'listen' for handlers

* make more sense

* move local function into a class method
2019-06-27 17:29:20 -04:00

43 lines
972 B
YAML

- name: test templated values in handlers
hosts: localhost
gather_facts: no
vars:
handler1: name1
handler2: name2
handler3: name3
handler4: name4
handlers:
- name: name1
set_fact:
non_templated_name: True
- name: "{{ handler2 }}"
set_fact:
templated_name: True
- name: testlistener1
set_fact:
non_templated_listener: True
listen: name3
- name: testlistener2
set_fact:
templated_listener: True
listen: "{{ handler4 }}"
tasks:
- command: echo Hello World
notify:
- "{{ handler1 }}"
- "{{ handler2 }}"
- "{{ handler3 }}"
- "{{ handler4 }}"
- meta: flush_handlers
- assert:
that:
- non_templated_name is defined
- templated_name is defined
- non_templated_listener is defined
- templated_listener is undefined
- include_role: name=test_templating_in_handlers