You could accomplish this with script+add_host

1) local_action script <inventoryscript> + register: output
2) add_host: {{ item }} with_items: output.stdout

On Friday, July 1, 2016 at 9:44:21 AM UTC-4, Arpit Ghiya wrote:
>
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f9ee62c2-5e8c-4c4a-893c-3f4e9d61379d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to