variable precedence - doc possibly wrong

Hi,

I have moved my inventory to “env/dev1/” and found that actual variable precedence is not what the doc says.
Here is the order of precedence I’m seeing on Ansible 2.0.0.2

env
└── dev1
├── ec2.ini
├── ec2.py
├── group_vars
│ ├── all.yaml (6)
│ └── group.yaml (4)
└── host_vars
└── host.yaml (2)
group_vars
├── all.yaml (5)
└── group.yaml (3)

host_vars
└── host.yaml (1)
playbook1.yaml

The documentation specify precedence as

inventory group_vars
inventory host_vars
playbook group_vars
playbook host_vars

I would say, there are two issues there:

  1. inventory and playbook var precedence is “interwined”
  2. it does not mention special handling for group “all”

Here is how it probably should be (from lower to higher precedence):

  • inventory group_vars/all

  • playbook group_vars/all

  • inventory group_vars/

  • playbook group_vars/

  • inventory host_vars

  • playbook host_vars

Do you want me to report an issue for code or documentation ?
(or explain that both are correct and it’s me who is confused)

Regards,

Brano Zarnovican

Could you please open an issue for this with a full working example? I believe I see what you’re talking about, but having something to test against would be useful in testing and validating.

Thanks!

Done.
https://github.com/ansible/ansible/issues/15278