Created
June 1, 2016 11:33
-
-
Save diversemix/1e5f46f53754aa18a4ac71a0696dd36f to your computer and use it in GitHub Desktop.
Test to see if ansible version supports switching the handler based on var
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: balancer | |
sudo: yes | |
serial: 1 | |
vars: | |
switch: False | |
name_of_handler: "{{ 'call_this' if switch else 'call_that' }}" | |
handlers: | |
- name: call_this | |
command: echo Switch is on | |
- name: call_that | |
command: echo Switch is off | |
- name: not_set | |
command: echo Not been set! | |
tasks: | |
- name: Test | |
command: "echo Test {{name_of_handler}}" | |
notify: "{{name_of_handler}}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment