Calling Ansible handlers based on OS distributions

---
- hosts: all
tasks:
- name: create a hello world textfile
copy:
content: "Hello World!"
dest: /tmp/hello.txt
owner: root
group: root
mode: 0640
notify:
- redhat handler
- debian handler
sudo: yes
handlers:
- name: redhat handler
debug: msg='redhat'
when: ansible_distribution == "RedHat"
- name: debian handler
debug: msg='debian'
when: ansible_distribution == "Debian"
Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x