# Strange? playbook behavior.

**URL:** <https://forum.ansible.com/t/strange-playbook-behavior/15478>\
**Category:** Ansible Project\
**Created:** [June 16, 2014, 9:37pm UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478 "2014-06-16T21:37:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Rosengren](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Jeremy\_Rosengren](https://forum.ansible.com/u/Jeremy_Rosengren)\
**Post date:** [June 16, 2014, 9:37pm UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478/1 "2014-06-16T21:37:16Z")

</div>

I have the following configuration:

$ cat env-provision  
[ec2-instances]  
[ec2-XX-XX-XX.compute-1.amazonaws.com](http://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

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 17, 2014, 7:07pm UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478/2 "2014-06-17T19:07:19Z")

</div>

Show me output that proves this?

I only see output from the above.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Rosengren](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Jeremy\_Rosengren](https://forum.ansible.com/u/Jeremy_Rosengren)\
**Post date:** [June 18, 2014, 3:39am UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478/3 "2014-06-18T03:39:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ernest0x](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@Ernest0x](https://forum.ansible.com/u/Ernest0x)\
**Post date:** [June 18, 2014, 7:19am UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478/4 "2014-06-18T07:19:41Z")

</div>

Search for “ansible variable precedence”.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Rosengren](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Jeremy\_Rosengren](https://forum.ansible.com/u/Jeremy_Rosengren)\
**Post date:** [June 18, 2014, 1:34pm UTC](https://forum.ansible.com/t/strange-playbook-behavior/15478/5 "2014-06-18T13:34:06Z")

</div>

Perfect and now understood. Thank you!

– jeremy
