Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

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
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x