Dear list,
I’m trying to copy a few specific files over using this in the host_var:
hostname: XXXXsnippedXXXXX
sid: XYZ555
war:
- version: Webapp_XXXXsnippedXXXXX1.war
linkname: programmaname1.war
- version: Webapp_XXXXsnippedXXXXX2.war
linkname: programmaname2.war
And this task:
- name: Mobbl | Kopieer de War(s) file naar de server
action: copy src=…/files/“${war.version}” dest=/usr/share/tomcat6/mobbl/“${war.version}” owner=root group=root mode=0644
with_items: $war
register: last_result
tags:
- mobblwar
But when I run this, I get this error:
mmaas@XXXXsnippedXXXXX:~/playbooks$ ansible-playbook -K --tags “mobblwar” ./XXXXsnippedXXXXX/site.yml
sudo password:
PLAY [XXXXsnippedXXXXX] *********************
TASK: [Mobbl | Kopieer de War(s) file naar de server] *********************
failed: [XXXXsnippedXXXXX] => (item={‘linkname’: ‘programmaname1.war’, ‘version’: ‘Webapp_XXXXsnippedXXXXX1.war’}) => {“failed”: true, “item”: {“linkname”: “programmaname1.war”, “version”: “Webapp_XXXXsnippedXXXXX1.war”}}
msg: could not find src=./binck/…/files/${war.version}
failed: [XXXXsnippedXXXXX] => (item={‘linkname’: ‘programmaname2.war’, ‘version’: ‘Webapp_XXXXsnippedXXXXX2.war’}) => {“failed”: true, “item”: {“linkname”: “programmaname2.war”, “version”: “Webapp_XXXXsnippedXXXXX2.war”}}
msg: could not find src=./XXXXsnippedXXXXX/…/files/${war.version}
FATAL: all hosts have already failed – aborting
PLAY RECAP *********************
t2wwwmitchel : ok=0 changed=0 unreachable=0 failed=1
It seems the file module is not getting the file name, but the variable instead. Which ofcourse does not exist.
Am I not escaping correctly perhaps?
Thanks,
Mark