Ansible contd
Inventories in Ansible
- Inventory is collection of nodes.
- Inventory is of two types
- Static
- Dynamic
- Inventory can be written in two formats
- ini format
- yaml format
- ini format
ipaddress/name
[group1]
ipaddress/name
ipaddress/name
[group2]
ipaddress/name
ipaddress/name
- Refer Here for sample inventories in ini format

* Refer Here for inventory documentation
* Yamls for inventories. Refer Here for changeset with inventory in yaml format


fact collection
- Refer Here for ansible facts
- To see the facts we have a module called as setup Refer Here
- Refer Here for the facts collected by ansible
Activity 4: Lets write one playbook for installing php in both redhat and ubuntu
- What is needed?
- inventory
- facts
- using facts with conditionals Refer Here
-
Refer Here for the changes done

-
Add a failback message for unsupported operating systems Refer Here for module. Refer Here for the changes done to the playbook

- Lets parametrize using Ansible variables. Refer Here
- Adding variables to inventory Refer Here
- debug module Refer Here
- Refer Here for the variables added
- Lets use generic package manager Refer Here
- Refer Here for loops and Refer Here for the changes done
- Refer Here for the changes done to move common values (i.e. ubuntu) to group vars and specif host values in host vars.
