Strange? playbook behavior.

I have the following configuration:

$ cat env-provision
[ec2-instances]
ec2-XX-XX-XX.compute-1.amazonaws.com vpn_ip=172.31.0.117 hostname=kafka ansible_ssh_private_key_file=~/.ssh/id_dsa

$ cat group_vars/ec2-instances
ansible_ssh_user: “ec2-user”

$ cat site-infra-provision.yml

Show me output that proves this?

I only see output from the above.

So I’ve figured this out…

One of the roles in the 2nd stanza had a vars/main.yml file that had ansible_ssh_user: “root” set. So it seems as though the 2nd host group was evaluating all of the role variables (at least ansible_ssh_user) and since that was set in the role it was performing Gather Facts as root instead of “ec2-user”, which was what ansible_ssh_user was set to in group_vars. Does that make sense?

Is this particular behavior documented somewhere?

Thanks,

– jeremy

Search for “ansible variable precedence”.

Perfect and now understood. Thank you!

– jeremy