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 place (no modification to the file at all) but the play says it runs successfully!
cshort-mba:ansible oaf357$ ansible-playbook pi_ddclient.yml -s
sudo password:
PLAY [daffy] ******************************************************************
GATHERING FACTS ***************************************************************
ok: [daffy]
TASK: [common | apt-get update] ***********************************************
ok: [daffy]
TASK: [common | Installing commonly installed files] **************************
ok: [daffy] => (item=curl,host,mercurial,ntpdate,vim)
TASK: [common | Make Vim Default Editor] **************************************
changed: [daffy]
TASK: [pi_ddclient | Install ddclient] ****************************************
ok: [daffy] => (item=ddclient)
TASK: [pi_ddclient | Copy /etc/ddclient.conf and /etc/defaults/ddclient to server] ***
ok: [daffy]
PLAY RECAP ********************************************************************
daffy : ok=6 changed=1 unreachable=0 failed=0
Here's the pi_ddclient.yml file:
---
- hosts: daffy
roles:
- common
- pi_ddclient
sudo: true
Here's the roles/pi_ddclient/tasks/main.yml file:
---
# Do all the ddclient things
- name: Install ddclient
apt: name={{ item }} state=latest
with_items:
- ddclient
- name: Copy /etc/ddclient.conf and /etc/defaults/ddclient to server
copy: src=roles/pi_ddclient/files/etc/ddclient.conf dest=/etc/ddclient.conf owner=root group=root mode=0600 backup=yes
copy: src=roles/pi_ddclient/files/etc/default/ddclient dest=/etc/default/ddclient owner=root group=root mode=0600 backup=yes
notify: restart ddclient
I should point out roles/pi_ddclient/files/etc/default/ddclient copies over just fine.
How can I debug successes in Ansible? Any thoughts on what is going wrong here?
Thank you in advance.