FWIW, the template module already knows where to look for the template
files: templates/
Same concept is true for other modules like copy which looks for the files
in the files/ folder.
Now, if you are willing to sacrifice the name of the task and make it a
little bit more broad, you could use
I believe the primary issue is that your pi_ddclient role's task file
specifies the same path to the source file as your ad-hoc command. Your
ad-hoc command doesn't know what roles are, so it needs the path to the
source file to start with roles/pi_ddclient/files/. However the role
already knows
It seems like you can't have multiple copy/template operations under one
name. I'm not sure if this is a YAML standard or an Ansible issue. I made
these files into templates and split the template operations out under two
names. Now it works. A little annoying but I did realize this was a
This ad-hoc command works for me:
ansible -s -m copy -a src=roles/pi_ddclient/files/etc/ddclient.conf
dest=/etc/ddclient.conf owner=root group=root mode=0600 backup=yes daffy
However when I run the playbook containing the same command (with sudo:
true specified) it does not copy the file into