Hi Brian,
On 08.02.17 17:49 Brian Coca wrote:
> One final clarification, you CAN override the inventory from the
> command line, but not via the specific switches, through
> extra-vars
>
> ansible -e 'ansible_user=xyz' ...
I think this bit is missing in the docs. Or rather, many people might
be confused what "extra vars" are. Or they might not know the
difference between "-e 'ansible_user=foo'" and "-u foo".
This may also be true for other items in the variable precedence list.
I guess not that many people have used a "play vars_prompt".
> Connection vars follow normal variable precedence, so extra_vars
> always have the highest precedence and override all other sources.
> The command line switches override the configs, but not the
> directives/connection variables as those are considered 'more
> specific'.
I was very pleased to see the very detailed precendence table appear here:
https://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
> It can be a bit confusing, but the system is designed to allow for
> very complex environments, as such it does assume some of that
> complexity itself.
But that's what allows it to do so many wonderful things... ;-)
Johannes