template not expanded after upgrading from 1.7 to 2.0.1.0

I am sure I missed something here, but couldn’t find a hint in the changelog. So far I used ansible 1.7 on Ubuntu 12.04.5 and recently upgraded to ansible 2.0.1.0 on ubuntu 16.04 (beta) and it worked well. Only one of my playbooks is causing problems.

The template in question sits in a sub directory called check_mk, and I call it like this:

ansible-playbook check_mk/gen_check_mk_config.yml

It gathers facts from all my servers and compiles a single configuration file to be put on some host. This works exactly like intended with my older ansible 1.7 installation, but not with my 2.0.1.0 installation on ubuntu 16.04 (beta). There is no error message, it just won’t expand the template but rather copy the generic jinja2 template, unexpanded, to the destination.

This is the playbook:

`
$ cat check_mk/gen_check_mk_config.yml

Does calling the playbook with

ansible-playbook -vvv check_mk/...

return any more info what goes wrong?

Johannes

hostvars is not a dict anymore, so .keys() might not work

The output is a bit long so I’m hesitating to post it here. But in my eyes it looks no different from the output of a working playbook execution. In particular there is no error message. Thank you anyway.

That’s it! Thank you so much. If I replace hostvars.keys() with groups[‘servers’] it works!

Using unsupported ways to access internal data structures (.keys()) should be avoided, I know, but still I wonder why ansible does not indicate a failed template expansion and simply pushes the jinja2 code, which in almost any case should be the wrong thing to do and lead to service failure.