Some strange bug in the template module when combining two variables - can someone confirm?

33 views
Skip to first unread message

Stephen Tan

unread,
Nov 25, 2014, 4:11:46 AM11/25/14
to ansible...@googlegroups.com

I think I may have uncovered a bug in the template module. Whatever I do, I can't remove inserted quotes for a dest path which are inserted by Ansible.
The same combination DOES work for other modules. 

I have tried using the join filter but this produces the same results!

Below is the relevant debug info:

------------------

vars:
xbmc_docker_dir: xbmc
docker_home: /opt/docker

- name: Create advanced_settings file for our Mysql XBMC server
  template: src=advancedsettings.xml.j2
            dest={{docker_home}}/{{xbmc_docker_dir}}/xbmcdata/userdata/advancedsettings.xml
            owner=root
            group=root
            mode=0644

Error:
TASK: [xbmc-headless-docker | Create advanced_settings file for our Mysql XBMC server] ***
failed: [thorn.home.stanandliz.net] => {"failed": true}
msg: Destination directory "/opt/docker"/"xbmc"/xbmcdata/userdata does not exist

FATAL: all hosts have already failed -- aborting

--------------

I have had to horribly hard code the paths in my dest command as a temporary workaround - please help me remove the abomination! :)

This variable combination/concatenation DOES work for the command module - for example the following runs the docker command with no problem ( I do know I can use the docker module for this but am testing to see wtf works and what doesn't...... )

- name: Run the docker image
  command: docker run -d --net=host --privileged -v "{{docker_home}}"/"{{xbmc_docker_dir}}"/xbmcdata/:/opt/xbmc-server/portable_data -v "{{mount_point}}":"{{mount_point}}" wernerb/docker-xbmc-server

Stephen Tan

unread,
Nov 25, 2014, 4:16:01 AM11/25/14
to ansible...@googlegroups.com
The version of ansible used:

stan@briar:~/ansible$ ansible --version
ansible 1.7.2
Reply all
Reply to author
Forward
0 new messages