I made a mistake – it’s not “for whatever reason the file cannot be copied” ... but it happens (at least) when I can’t open the remote file (permission denied).
[ehymowitz test]$ ls -al cougar total 8,192 drwx------. 2 ehymowitz ehymowitz 4,096 Oct 3 13:15 . drwx------. 3 ehymowitz ehymowitz 4,096 Oct 3 13:13 .. [ehymowitz test]$ cat fetch.yaml - hosts: cougar gather_facts: no tasks: - name: fetch fetch: src: /etc/sysconfig/iptables dest: "/home/ehymowitz/ansible/test/cougar/{{inventory_hostname}}.iptables" flat: yes [ehymowitz test]$ ansible-playbook fetch.yaml PLAY [cougar] ****** TASK [fetch] ******* [WARNING]: sftp transfer mechanism failed on [cougar]. Use ANSIBLE_DEBUG=1 to see detailed information [WARNING]: scp transfer mechanism failed on [cougar]. Use ANSIBLE_DEBUG=1 to see detailed information [WARNING]: piped transfer mechanism failed on [cougar]. Use ANSIBLE_DEBUG=1 to see detailed information fatal: [cougar]: FAILED! => {"msg": "failed to transfer file to /etc/sysconfig/iptables /home/ehymowitz/ansible/test/cougar/cougar.iptables:\n\ndd: opening `/etc/sysconfig/iptables': Permission denied\n"} to retry, use: --limit @/home/ehymowitz/ansible/test/fetch.retry PLAY RECAP ******* cougar : ok=0 changed=0 unreachable=0 failed=1 [ehymowitz test]$ ls -al cougar total 8,192 drwx------. 2 ehymowitz ehymowitz 4,096 Oct 3 13:15 . drwx------. 3 ehymowitz ehymowitz 4,096 Oct 3 13:13 .. -rw-------. 1 ehymowitz ehymowitz 0 Oct 3 13:15 cougar.iptables --EbH From: ansible-project@googlegroups.com <ansible-project@googlegroups.com> On Behalf Of Brad Van Orden Sent: Wednesday, 3 October, 2018 08:45 To: Ansible Project <ansible-project@googlegroups.com> Subject: [ansible-project] Re: ansible fetch fails but creates zero-length file Eric, Can you provide your task? Any error messages? On Tuesday, October 2, 2018 at 1:45:38 PM UTC-4, eric.b....@nasa.gov<mailto:eric.b....@nasa.gov> wrote: When I use the fetch module (with or without using become, which is contra-indicated but I have no choice), and for whatever reason the file cannot be copied, the local machine still creates a zero-length file. Is there a way to disable this behavior? Thanks. --EbH -- You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/17x7STEFyDg/unsubscribe. To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscr...@googlegroups.com<mailto:ansible-project+unsubscr...@googlegroups.com>. To post to this group, send email to ansible-project@googlegroups.com<mailto:ansible-project@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/404be531-7cc1-4fd4-b383-0964a65d0947%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/404be531-7cc1-4fd4-b383-0964a65d0947%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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9403C12F122160449344D72243C2F3D2166633B7%40NDMSMBX402.ndc.nasa.gov. For more options, visit https://groups.google.com/d/optout.