Default inventory file is usually /etc/ansible/hosts, although you can 
override this by setting something different in your ansible.cfg (along 
with a lot of other options - 
see http://docs.ansible.com/ansible/intro_configuration.html )

As well as using -i to specify which inventory you want to load you can 
also set an environment variable.

   export ANSIBLE_INVENTORY=your_inventory_file


Hope this helps,

Jon

On Tuesday, January 3, 2017 at 2:41:45 PM UTC, [email protected] wrote:
>
> Hello - 
>
> I have a use case where I have two of the same apps installed on one 
> server in a shared Prod-Like/Disaster Recovery (PL/DR) environment. I use 
> Ansible to automate application configuration tasks for each app on the 
> server. As of right now, this isn't working for PL/DR because Ansible has 
> no way to determine which host_vars are required. Does it load PL or does 
> it load DR? 
>
> I did some searching and found Ansible Best Practices - Alternative 
> Directory Layout 
> <http://docs.ansible.com/ansible/playbooks_best_practices.html#alternative-directory-layout>.
>  
> It looks like this might solve my problem. It splits out a "production" and 
> "staging" directory. Each has their own host, group, and inventory files. 
>
> My questions are are around how this works? What is the "glue" such that 
> Ansible knows how to find certain files? In their example layout, how does 
> the playbook "site.yml" know to load the 'production' inventory versus the 
> 'staging' inventory? Is it all hard coded user facts? Does it assume we 
> specify '-i' each time?
>
> Any info, other examples, or other potential solves for this would be much 
> appreciated. 
>
> Thank you!
>

-- 
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/6f4238f8-0db8-475a-9fca-49456cae44bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to