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?