I am templating a file with a set of variables in Ansible.
A few entries in my defaults/main.yaml file are :
jenkins_plugins:
'ant': '1.8'
'antisamy-markup-formatter': '1.5'
'apache-httpcomponents-client-4-api': '4.5.3-2.1'
'kubernetes': '1.3'
One of this key-value pair is supposed to be injected in this line in my template file config.xml.j2 :
<markupFormatter class="hudson.markup.RawHtmlMarkupFormatter" plugin="antisamy-markup-formatter@{{ jenkins_plugins.antisamy-markup-formatter }}">
So basically my end result should look like :
<markupFormatter class="hudson.markup.RawHtmlMarkupFormatter" plugin="antisamy-markup-formatter@1.5">
But when I run the playbook that calls this templating file, I get the ERROR :
TASK [jenkins : Generate config.xml file.] ****************************************
fatal: [default]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'antisamy'"}
If I remove all the dashes -, it will work fine but that is something I cannot do since I also have to download these plugins and I need to curl on the correct names with dashes.
Why is the jinja templating skipping everything after - ?