Ansible Playbooks conditions
Ansible Playbooks conditions
In this article, we will see ansible-playbook condition which is more important and whenever we have different scenarios, we put conditions according to the scenario.When statement
Sometimes you want to skip a particular command on a particular node.--- # Condition Playbook
- hosts: demo
user: ansible
become: yes
connection: ssh
tasks:
- name: install apache on debian
command: apt-get -y apache2
when: ansible_os_family=="Debian"
- name: install apache for redhat
command: yum -y install https
when: ansible_os_family=="RedHat"
0 comments
Please leave your comments...... Thanks