summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/handlers/test_templating_in_handlers.yml
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/handlers/test_templating_in_handlers.yml')
-rw-r--r--test/integration/targets/handlers/test_templating_in_handlers.yml62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/integration/targets/handlers/test_templating_in_handlers.yml b/test/integration/targets/handlers/test_templating_in_handlers.yml
new file mode 100644
index 0000000..662b8c1
--- /dev/null
+++ b/test/integration/targets/handlers/test_templating_in_handlers.yml
@@ -0,0 +1,62 @@
+- name: test templated values in handlers
+ hosts: localhost
+ gather_facts: no
+ vars:
+ handler1: name1
+ handler2: name2
+ handler3: name3
+ handler4: name4
+ handler_list:
+ - name5
+ - name6
+
+ 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 }}"
+ - name: name5
+ set_fact:
+ handler5: True
+ - set_fact:
+ handler6: True
+ listen: name6
+
+ 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
+
+ - command: echo
+ notify: "{{ handler_list }}"
+
+ - meta: flush_handlers
+
+ - assert:
+ that:
+ - handler5 is defined
+ - handler6 is defined
+
+ - include_role: name=test_templating_in_handlers