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?
-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
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).
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.
…(“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!