Hi all, first time posting, so apologies if I miss something.

I'm working on organizing an inventory folder for a multistage environment 
and would like verification on whether the way I expect to work is true, or 
if I'm missing something.


*Objective*
Using the following inventory folder structure:
.
├── production/
│   ├── group_vars/
│   ├── host_vars/
│   │   └── hostname-prod.fqdn.yml
│   └── inventory.ini  # (*contains entry for hostname-prod.fqdn*)
│
├── staging/
│   ├── group_vars/
│   ├── host_vars/
│   │   └── hostname-stage.fqdn.yml
│   └── inventory.ini  # (*contains entry for hostname-stage.fqdn*)
│
└── testing/
    ├── group_vars/
    ├── host_vars/
    │   └── hostname-test.fqdn.yml
    └── inventory.ini  # (*contains entry for hostname-test.fqdn*)

I would execute a playbook (with "hosts: hostname-prod.fqdn") to be run as 
follows, with the expectation that it will automatically pick up the 
hostname entry from the "production/inventory.ini" and the associated host 
variables from the "production/host_vars/hostname-stage.fqdn.yml" file:

$> ansible-playbook my-play.yml


*Problem*
When I try to do this, the hostname entry is indeed picked up from the "
production/inventory.ini"  file, however, the associated host variables 
aren't picked up from the "production/host_vars/hostname-stage.fqdn.yml" 
file.

If I run the command as follows though, it does work:

$> ansible-playbook -i production my-play.yml


*Question*
Is this the correct and expected behavior? Or should my original method 
work without specifying "-i production"?

-- 
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/2a990fab-5358-4ca0-b5ad-3525879e6199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to