I want to copy file using jinja2 templating in ansible.
I have one file inside templates/file.j2 and inside that file I have one variable defined
fos.broker.host={{ fos.broker.host }}
Inside group_vars/stage I have the value of this variable as
fos.broker.host: 'api_vl.vlstage.fidor.de'
And finally I am deploying it via main.yml and it looks like.
---
- hosts: vlstage
vars_files:
- group_vars/vlstage
tasks:
- name: copy files to host
template: src=templates/file.j2 dest=/opt/tomcat/lib/file.conf
backup=yes owner=zoaib group=zoaib
but when I run command ansible-playbook -i hosts main.yml -u zoaib
I get below error:
TASK [copy files to host] *************************************************************************************************************************************************************
fatal: [s-vl-idl-app02.fidor.intern]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'fos' is undefined"}
any leads to solve the issue ?