Ansible Variables
- Refer Here for official docs
- Ansible variables can be declared in
- playbook
- inventory files
- passed during executing playbooks
- We have created variables at playbook level Refer Here for changes
- As discussed we can pass values as extra vars during playbook executions
ansible-playbook -e "default_shell=/bin/bash" -i hosts ubuntu.yaml
- If the variable is defined at multiple places then ansible will resolve the variable value according to precendence Refer Here
Inventory files
-
Inventory is of two types
- static inventory:
- ini format
- yaml format
- dynamic inventory:
- static inventory:
-
Best Practice: Refer Here for organizing inventories and variables using group and host vars
Activity: Installing tomcat on ubuntu 22.04 contd
-
Refer Here for changes done to download tomcat
-
Refer Here for downloading and extracting tomcat
-
Exercise:
- Try installing Tomcat on centos or redhat
- compare the steps between redhat and ubuntu
