Ansible 2 template src path changed ?

631 views
Skip to first unread message

Nicolas G

unread,
Jan 26, 2016, 1:23:59 PM1/26/16
to Ansible Project
Hi

I have the bellow template stored under the shared role but it's been deployed by other roles as in our web role in our example :

# roles/shared/templates/config.conf.j2

#roles/web/taks/main.yml :
- name: deploy config
 
template: src=config.conf.j2 dest=/etc/project/config.conf



In Ansible 1.9.4 the above works. 

In Ansible 2.0.0.2 this fails :

TASK [web : deploy config] ************************
fatal
: [server001.example.com]: FAILED! => {"changed": false, "failed": true, "msg": "IOError: [Errno 2] No such file or directory: u'/src/Ansible/config.conf.j2'"}



In order for this to work on version 2 I have to change the src path to ../shared/templates/config.conf.j2 but this will break compatibility with Ansible version 1 :

roles/web/taks/main.yml :
- name: deploy config
 
template: src=../shared/templates/config.conf.j2 dest=/etc/project/config.conf



Can someone confirm if this is a change in Ansible version 2 or should report a bug ?


Nicolas G

unread,
Jan 27, 2016, 1:48:57 PM1/27/16
to Ansible Project
As suggested by James Camarata in the webinar , the template module code has changed a lot.

Reply all
Reply to author
Forward
0 new messages