# template in parameter doesn't work for custom modules

**URL:** <https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096>\
**Category:** Ansible Project\
**Created:** [December 8, 2013, 2:11am UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096 "2013-12-08T02:11:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xu\_Chen](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@Xu\_Chen](https://forum.ansible.com/u/Xu_Chen)\
**Post date:** [December 8, 2013, 2:11am UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096/1 "2013-12-08T02:11:32Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Xu\_Chen](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@Xu\_Chen](https://forum.ansible.com/u/Xu_Chen)\
**Post date:** [December 8, 2013, 6:26am UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096/2 "2013-12-08T06:26:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 8, 2013, 3:58pm UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096/3 "2013-12-08T15:58:05Z")

</div>

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

[http://ansibleworks.com/docs/intro\_configuration.html#error-on-undefined-vars](http://ansibleworks.com/docs/intro_configuration.html#error-on-undefined-vars)

---

<div class="post-metadata">

**Author:** ![Xu\_Chen](https://avatars.discourse-cdn.com/v4/letter/x/958977/32.png) [@Xu\_Chen](https://forum.ansible.com/u/Xu_Chen)\
**Post date:** [December 9, 2013, 12:11am UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096/4 "2013-12-09T00:11:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 9, 2013, 12:29am UTC](https://forum.ansible.com/t/template-in-parameter-doesnt-work-for-custom-modules/14096/5 "2013-12-09T00:29:08Z")

</div>

Caught but probably not well raised.

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

Thanks!
