Create an Ansible Playbook which will dynamically
load the variable file named same as OS_name and just by
using the variable names we can Configure our target node.
- Ansible installed.
- Inventory configured.
Step-1)Retreive the distro.
- First, we need to retrieve the distribution from ansible facts after use it.
- After we retrieve the distro, now we need to make the files respective to the distro, like — RedHat-8.yml, Ubuntu-16.yml, etc.
- First, we need to make the playbook for the distro.
- Here we need to give a package according to the distro.
- After that, we use this var at the time of installing the webserver from a playbook.
- Now include the ansible facts with the yml file, it automatically detects the file name with the distro name from the ansible facts.
Step-3)Run the Playbook.
- After this, run the playbook
- Now type the IP.