Hello
We are currently in a process to switch from our current legacy systems to Ansible for server provisioning and deployment. All of our server details are stored in ruby configuration files [.rb], which is obviously our server inventory right now.
Now, we are planning to use the same config files as input to ansible-playbook for deployment. I can write a script which will read my ruby file and create a ansible style inventory file on the run time. Now, it is possible for Ansible to read the inventory dynamically after the execution starts?
Eg:
Step 1: Call Ansible-Playbook (with a variable to define my environment; eg: qa/uat etc)
Step 2; I call my custom script which in turn reads ruby config file for that particular environment and generates the Ansible inventory
Step 3: Ansible now reads the inventory and proceeds with the remaining tasks from the playbook.
P.S. The reason we are a bit reserved about creating inventory in Ansible on the first place is because we don’t want redundant information. The ruby config files act as a Golden Source for server details for many other systems as well. If we replicate them in Ansible inventory - we will end up managing them at two places.