Hi,

I think instead writing a script that then writes an inventory file, just write 
a dynamic inventory and pass that as inventory file to ansible. I believe it 
will make your life easier in the long run.


—
A.

> On 1 Jul 2016, at 07:50, Arpit Ghiya <[email protected]> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/10a773cc-94f5-4c2e-83b4-dcd7bf6ec1cc%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/10a773cc-94f5-4c2e-83b4-dcd7bf6ec1cc%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/F0694BD4-771F-47B9-B2EC-A7717C1D7FAA%40andreatartaglia.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to