DYNAMIC VARIBALE FILE IN ANSIBLE
Hello forks ,
Here i am again with new concept of ansible called dynamic variable file !
Requirement : -
we need dynamic variable fil because suppose we need to launch a http webserver and we have 2 targetted nodes one OS i sredhat and second OS is ubantu . so , for installing httpd in redht we use package name httpd while ubantu uses apach2 as a package name to install httpd !
Firstly we will create two variable files in which as per os required we will set two diffrent package name .
Ubuntu.yml
package: apache2
web_port: 80RedHat.yml
package: httpd
web_port: 80
how we call neded file dynamically ? :- we will use ansible facts and we will fetch the distribution name which gives OS name so we can call needed OS variable file vice versa on run time dynamically !