Ansible Variables
- So if we try install apache on centos & ubuntu our playbook will appear as
---
- hosts: ubuntu
become: yes
tasks:
- name: install apache
package:
name: apache2
state: present
- hosts: centos
become: yes
tasks:
- name: install apache in centos
package:
name: httpd
state: present
- So lets use the variable concept of ansible Refer Here
- Variables in the ansible can be defined in
- inventory
- folders around inventory
- playbook
- commandline
- For today’s session lets focus on variables in inventory
- Lets create a simple playbook Refer Here
- IN ansible to run the same task with different values, lets use a ansible loop Refer Here
- Exercise: Now try Writing an ansible playbook for install tomcat8 on ubuntu and centos
- ubuntu Refer Here
- centos Refer Here
