# Template value pairs vs. in-playbook value pairs difference

**URL:** <https://forum.ansible.com/t/template-value-pairs-vs-in-playbook-value-pairs-difference/15503>\
**Category:** Ansible Project\
**Created:** [June 19, 2014, 3:31pm UTC](https://forum.ansible.com/t/template-value-pairs-vs-in-playbook-value-pairs-difference/15503 "2014-06-19T15:31:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jepper](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jepper](https://forum.ansible.com/u/jepper)\
**Post date:** [June 19, 2014, 3:31pm UTC](https://forum.ansible.com/t/template-value-pairs-vs-in-playbook-value-pairs-difference/15503/1 "2014-06-19T15:31:48Z")

</div>

I have this inconsistency when I declare variable pairs used in a template vs. variable pairs used directly in a playbook e.g:

Works in a template:group\_vars/all  
fusemq\_users:

- { ‘username’: ‘admin’, ‘password’: ‘admin’, ‘role’ : ‘admin’ }

role\_name/templates/users.properties  
{% for line in fusemq\_users %}  
{{ line.username }}={{ line.password }},{{ line.role }}  
{% endfor %}

The same format, used in a play book does not work - e.g. below is not working:

fusemq\_activemq\_jmx:

- { ‘username’ : ‘admin’, ‘password’ : ‘admin1234’ }

- name: set activemq.jmx.user  
lineinfile: dest={{ fusemq\_home }}/etc/system.properties regexp=“^#activemq.jmx.user” line=“#activemq.jmx.user={{ fusemq\_activemq\_jmx.username }}”

If I remove the preceding dash, it works, e.g.  
{ ‘username’ : ‘admin’, ‘password’ : ‘admin1234’ }

Is this expected?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 19, 2014, 9:25pm UTC](https://forum.ansible.com/t/template-value-pairs-vs-in-playbook-value-pairs-difference/15503/2 "2014-06-19T21:25:51Z")

</div>

In one, you have fusemq\_users as a list, in the other, you have a hash.

If you are going to feed it a list, perhaps you want to use with\_items, or otherwise, perhaps you want to reference the first element in the list.
