Hi,
I would like to create dynamically some configuration files (the configs are used by tomcat) using a template based some variables from group_vars
Below is what I have
- group_vars/test.yml
file:
- log4j
- config
log4j:
log4j.rootCategory: INFO
log4j.appender.SYSLOG: org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.syslogHost: testhost
jira:
jira.soap.url: https://hostname
jira.login.username: test
jira.login.password: test14
-
roles/test/main.yml
-
name: ‘Configure the application properties’
template:
src: “template.j2”
dest: “/tmp/{{ item }}.properties”
owner: build
group: build
backup: yes
with_items: “{{ file }}” -
roles/test/template/template.j2
{% for key, value in {{ item.iteritems() }} %}
{{ key }}= {{ value }}
{% endfor %}
So I would like to iterate every “file” and to create the files
I’m receiving “msg”: “AnsibleError: template error while templating string: expected token ‘:’, got ‘}’. String: ## File managed by ansible ##\n\n{{ item }}\n{{ propertyfiles }}\n\n{% for i in {{ propertyfiles }} %}\n {% for key, value in i.items() %}\n {{ key }}= {{ value }}\n {% endfor %} \n{% endfor %} \n”}