For those who find this same issue in the future, the error will still appear unless you add state: file
to the copy module, as documented in here: https://github.com/ansible/ansible-modules-core/issues/468 On Tuesday, November 11, 2014 at 12:26:23 PM UTC-8, Sean McGowan wrote: > > issue #302 - ansible-modules-core > > thanks! > > and i never expect fifo's to work, but it is a nice shortcut when testing. > :) > > > On Friday, November 7, 2014 9:13:33 AM UTC-5, Michael DeHaan wrote: >> >> Assuming you mean the (>$) whichever weird syntax, using fifo's as an >> inventory file was never really an intended thing. >> >> Please file a bug on the hardlink issue so we can investigate. >> >> Thanks! >> >> On Wed, Nov 5, 2014 at 4:53 PM, Sean McGowan <[email protected]> wrote: >> >>> yes.. 1.7.2 is installed now and the result is the same. also, as an >>> interesting aside, I apparently can no longer use bash FIFOs as an >>> inventory file like i did in the previous example. >>> >>> >>> On Wednesday, November 5, 2014 9:20:03 AM UTC-5, Michael DeHaan wrote: >>>> >>>> Can you please check and see if you have a problem on Ansible 1.7.2? >>>> >>>> We can't support older versions on this list. >>>> >>>> >>>> >>>> On Tue, Nov 4, 2014 at 5:04 PM, Sean McGowan <[email protected]> wrote: >>>> >>>>> Background: I am using Ansible 1.5 on RedHat. Apparently >>>>> system-config-network creates a hard link to /etc/hosts and >>>>> /etc/resolve.conf. I want to be able to copy the correct hosts file in >>>>> place if is not there, whether or not the file links is > 1. >>>>> >>>>> What happens: If the source file is already the same as the >>>>> destination, I get FAILED with a message "absolute paths are required". >>>>> >>>>> I can find this message in the code of the file module, not the copy >>>>> module. Also, if the source file is different, the copy works fine. I >>>>> am >>>>> assuming that it gets to the file module somehow after the atomic copy >>>>> call >>>>> in the copy module. >>>>> >>>>> Anyhow, can someone please tell me if this should be expected and/or >>>>> if there is a good work around? >>>>> >>>>> Below is an example... Thanks in advance! >>>>> >>>>> ### /etc/hosts has > 1 links >>>>> [root@padishah1 ansible]# ls -l /etc/hosts >>>>> -rw-r--r--. 2 root root 13888 May 16 17:21 /etc/hosts >>>>> [root@padishah1 ansible]# find /etc -xdev -samefile /etc/hosts >>>>> /etc/sysconfig/networking/profiles/default/hosts >>>>> /etc/hosts >>>>> >>>>> ### hosts.bkp = hosts && hosts.different != hosts >>>>> [root@padishah1 ansible]# md5sum /etc/hosts /etc/hosts.{bkp,different} >>>>> 0f7cc9afcb0f17a9864b45391027a6ad /etc/hosts >>>>> 0f7cc9afcb0f17a9864b45391027a6ad /etc/hosts.bkp >>>>> 9c5799def96f6f2e7309a3914075589b /etc/hosts.different >>>>> >>>>> ### Trying to use the copy module with an identical file fails >>>>> [root@padishah1 ansible]# ansible all -i <(echo -e "localhost >>>>> ansible_connection=local") -m copy -a "src=/etc/hosts.bkp dest=/etc/hosts >>>>> mode=0644 owner=root group=root" --check >>>>> localhost | FAILED >> { >>>>> "failed": true, >>>>> "md5sum": "0f7cc9afcb0f17a9864b45391027a6ad", >>>>> "msg": "absolute paths are required" >>>>> } >>>>> >>>>> ### Trying to copy with a new file is sucessful >>>>> [root@padishah1 ansible]# ansible all -i <(echo -e "localhost >>>>> ansible_connection=local") -m copy -a "src=/etc/hosts.different >>>>> dest=/etc/hosts mode=0644 owner=root group=root" --check >>>>> --- before: /etc/hosts >>>>> +++ after: /etc/hosts.different >>>>> ---diff redacted--- >>>>> + >>>>> localhost | success >> { >>>>> "changed": true >>>>> } >>>>> >>>>> ### This is not the case when links = 1 >>>>> [root@padishah1 ansible]# cp -p --remove-destination /etc/hosts.bkp >>>>> /etc/hosts >>>>> cp: overwrite `/etc/hosts'? yes >>>>> [root@padishah1 ansible]# ls -l /etc/hosts >>>>> -rw-r--r--. 1 root root 13888 May 16 17:21 /etc/hosts >>>>> >>>>> ### Identical file is now successful (changed: false is expected) >>>>> [root@padishah1 ansible]# ansible all -i <(echo -e "localhost >>>>> ansible_connection=local") -m copy -a "src=/etc/hosts.bkp dest=/etc/hosts >>>>> mode=0644 owner=root group=root" --check >>>>> >>>>> localhost | success >> { >>>>> "changed": false, >>>>> "dest": "/etc/hosts", >>>>> "gid": 0, >>>>> "group": "root", >>>>> "md5sum": "0f7cc9afcb0f17a9864b45391027a6ad", >>>>> "mode": "0644", >>>>> "owner": "root", >>>>> "path": "/etc/hosts", >>>>> "secontext": "unconfined_u:object_r:etc_t:s0", >>>>> "size": 13888, >>>>> "state": "file", >>>>> "uid": 0 >>>>> } >>>>> >>>>> [root@padishah1 ansible]# ansible all -i <(echo -e "localhost >>>>> ansible_connection=local") -m copy -a "src=/etc/hosts.different >>>>> dest=/etc/hosts mode=0644 owner=root group=root" --check >>>>> --- before: /etc/hosts >>>>> +++ after: /etc/hosts.different >>>>> ---diff redacted--- >>>>> + >>>>> >>>>> localhost | success >> { >>>>> "changed": true >>>>> } >>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Ansible Project" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> To view this discussion on the web visit https://groups.google.com/d/ >>>>> msgid/ansible-project/40c40d20-daec-400c-8db4- >>>>> 23bef72f7c9d%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/ansible-project/40c40d20-daec-400c-8db4-23bef72f7c9d%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/3fccca8c-63c8-41fa-8c7b-50c78d03cee0%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/3fccca8c-63c8-41fa-8c7b-50c78d03cee0%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1d1bbdcc-a515-4d59-b499-3edf6a62f4aa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
