copy module failure detection issue

8 views
Skip to first unread message

Narahari 'n' Savitha

unread,
Aug 1, 2018, 11:44:19 AM8/1/18
to Ansible Project
Friends:

Thank you for your time and attention in advance.

I use the anisble copy module to copy to a machine in ADHOC mode.

The copy command looks like this

ansible TOMCATS_GROUP_ALL -i "func_testing_machine", -m copy -a "src=/home/the_ansible_user/certs/ftm/ dest=/opt/zebra/tomcat_mods/conf mode=640 owner=tcuser group=tcgrp force=yes follow=yes" -u ansi_user

The ansi_user does not have admin rights.


However when the above command runs I get the output like this

func_testing_machine | SUCCESS => {
    "changed": false,
    "dest": "/opt/zebra/tomcat_mods/conf",
    "failed": false,
    "src": "/home/the_ansible_user/certs/ftm/"
}

But I DO NOT get an error back.

The ansi_user should not be able to copy to the destination since the ansi_user is NOT the owner of the folder or the files.


However I dont see any errors saying

could not copy
permission denied


or when I do 
echo $?
0

So what should I rely on for a successful copy ?

Any thoughts ?

-Narahari

PS:  Is there an ansible bug    reporting process please .

Brian Coca

unread,
Aug 1, 2018, 6:16:54 PM8/1/18
to Ansible Project
As i responded in the ticket:

This is not a bug, changed: False shows that no change was needed, so
the 'copy' was considered successful (the files already existed as
required on the target).

Ansible will only try to copy the file if it detects it needs to or
you use force: yes, otherwise it just verifies the files are what is
expected.

This is true for most actions in Ansible, they enforce 'state' instead
of always performing an action.


----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages