# ansible\_facts broken?

**URL:** <https://forum.ansible.com/t/ansible-facts-broken/11686>\
**Category:** Ansible Project\
**Created:** [July 16, 2012, 12:29pm UTC](https://forum.ansible.com/t/ansible-facts-broken/11686 "2012-07-16T12:29:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpmens1](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jpmens1](https://forum.ansible.com/u/jpmens1)\
**Post date:** [July 16, 2012, 12:29pm UTC](https://forum.ansible.com/t/ansible-facts-broken/11686/1 "2012-07-16T12:29:19Z")

</div>

Hello,

up until yesterday evening CET, I had a module returning ansible\_facts  
which worked, but that seems to be broken now: facts aren't passed on to  
templates:

Can somebody confirm this?

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-JP

ANSIBLE\_SSH\_ARGS="" ANSIBLE\_REMOTE\_USER=f2 ansible-playbook --connection=ssh j1.yaml -v

PLAY [a1.ww.mens.de] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [a1.ww.mens.de]

TASK: [Gather our facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [a1.ww.mens.de] =\> {"ansible\_facts": {"kerberos\_keytab\_princs": ["host/a1.ww.mens.de@MENS.DE", "service/wallet@MENS.DE"], "keytab": "/etc/krb5.keytab", "sysinfo": {"syscontact": "Jane Jolie", "sysemail": "janej@example.com"}, "tmpfiles": 21, "year": 2006}}

TASK: [Demotemplate] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [a1.ww.mens.de] =\> {'msg': "'sysinfo' is undefined", 'failed': True}  
fatal: [a1.ww.mens.de] =\> {'msg': "'sysinfo' is undefined", 'failed': True}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
a1.ww.mens.de : ok=2 changed=0 unreachable=1 failed=0

Template:

{% if sysinfo.syscontact is defined -%}  
The manager hereabouts is {{ sysinfo.syscontact }} \<{{sysinfo.sysemail}}\>  
{% endif -%}  
Currently {{tmpfiles}} files in /tmp

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 16, 2012, 1:02pm UTC](https://forum.ansible.com/t/ansible-facts-broken/11686/2 "2012-07-16T13:02:02Z")

</div>

It's quite possible, it is the development branch 🙂

We used to have template tests for the \*runner\* code, but now that this works differently, we probably need to add some to verify templates from play books work correctly. (i.e. much better playbook tests).

You and other folks may wish to dig around execute\_template\_module code to see what is getting passed to what template methods, I won't be able to look at until much later tonight (EST).

---

<div class="post-metadata">

**Author:** ![John\_Callender](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@John\_Callender](https://forum.ansible.com/u/John_Callender)\
**Post date:** [July 16, 2012, 8:59pm UTC](https://forum.ansible.com/t/ansible-facts-broken/11686/3 "2012-07-16T20:59:46Z")

</div>

I started seeing a problem with host-specific variables defined in my inventory file being unavailable in plays when I updated to the latest devel code this morning. I ran the following to inspect the values being returned from the host file:

ansible -m setup -i etc/ansible/hosts dev

…(“dev” being the name of my host) and confirmed that yeah, as of the latest code, the host-specific values I’d been receiving that were defined in the inventory file were no longer being returned. Using git bisect I determined that this was the commit when they stopped showing up:

76461d49004f0e2c0a50dcb1db3f43f33c46c77b is the first bad commit  
commit 76461d49004f0e2c0a50dcb1db3f43f33c46c77b  
Author: Michael DeHaan \<…\>

No need to feed variables into the setup module for preservation since the file is no longer saved to disk.

I’ve switched to the master branch for my local copy of ansible, and things are happy again. I can try to put together a minimal inventory/playbook to demonstrate the failing behavior if that would be helpful. I’m not sure if this is the same issue being discussed in this thread, but it sounds similar, at least.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 16, 2012, 9:13pm UTC](https://forum.ansible.com/t/ansible-facts-broken/11686/4 "2012-07-16T21:13:16Z")

</div>

> …(“dev” being the name of my host) and confirmed that yeah, as of the latest code, the host-specific values I’d been receiving that were defined in the inventory file were no longer being returned. Using git bisect I determined that this was the commit when they stopped showing up:
> 
> 76461d49004f0e2c0a50dcb1db3f43f33c46c77b is the first bad commit  
> commit 76461d49004f0e2c0a50dcb1db3f43f33c46c77b  
> Author: Michael DeHaan \<…\>  
> Date: Sun Jul 15 10:24:38 2012 -0400
> 
> No need to feed variables into the setup module for preservation since the file is no longer saved to disk.

Thanks! I bet this will fix JP’s problem as well.

Will take a look tonight and share results when I get it fixed.

> I’ve switched to the master branch for my local copy of ansible, and things are happy again. I can try to put together a minimal inventory/playbook to demonstrate the failing behavior if that would be helpful. I’m not sure if this is the same issue being discussed in this thread, but it sounds similar, at least.

Nah, easy enough to replicate, appreciate the offer though!
