template in parameter doesn't work for custom modules

I am writing my own module, similar to keystone_user to configure keystone services and endpoints. I made keystone_endpoint file very similar to keystone_user. And in the task file, have the following:

  • name: configure cinder service
    keystone_endpoint: service_name=cinder service_type=volume token=“xxx” endpoint=http://{{ ansible_default_ipv4.address }}:35357/v2.0 …

For some reason, the {{ ansible_default_ipv4.address }} part isn’t expanded in the parameter file copied to the remote host. Anything I forgot to add maybe?

Thanks…

Ah, I know why now…

I wrote my own jinja2 filter, and I was supposed to use that filter in the same task. So it’s like this:

  • name: configure cinder service
    keystone_endpoint: service_name=cinder service_type=volume token=“xxx” endpoint=http://{{ ansible_default_ipv4.address }}:35357/v2.0

token={{ somevar|my_filter }}

But I coded a wrong filter name, so the entire template instantiation process failed.

Do you perhaps have the undefined variable detection turned off in ansible.cfg?

http://ansibleworks.com/docs/intro_configuration.html#error-on-undefined-vars

Nope… I never touched that setting, so should be on default.

Like I said, I wrote my own jinja2 filter, and used the wrong filter name. So it’s actually an undefined filter… Not sure if that error is caught.

Caught but probably not well raised.

Can you file a github ticket about the undefined filter name not raising an error message?

Thanks!