Ansible fetch module cannot find file although it exists

758 views Asked by At

I simply want to download a file from a remote NXOS device to the ansible 2.9 controller using the fetch module. The xml looks like this:

  - name: fetch module sux
    fetch:
      src: "/tmp/deleteme/deleteme.txt"
      dest: "/ansibile-vault"
    register: output

But when i run the code i get following file not found message:

    "msg": "file not found: /tmp/deleteme/deleteme.txt",
    "invocation": {
        "module_args": {
            "src": "/tmp/deleteme/deleteme.txt"
        }
    }

I know the user i'm using has the correct access rights. I also know i'm on the right device (APIC3). And when i debug the code i can clearly see that this file exists. This is the debugging code:

  - name: check device
    nxos_command: 
      commands: "uname -a && cd /tmp && cd deleteme && ls -ahl"

Following output from debug:

    "stdout_lines": [
        [
            "Linux APIC3 4.14.211atom-1 #1 SMP Wed Dec 16 17:57:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux",
            "total 4.0K",
            "drwxr-xr-x 2 s-awx admin  60 Oct 12 11:11 .",
            "drwxrwxrwt 3 root  root  400 Oct 12 12:48 ..",
            "-rw-r--r-- 1 s-awx admin   9 Oct 12 11:11 deleteme.txt",
            "\u001b[1m\u001b[7m%\u001b[m\u001b[1m\u001b[0m"
        ]
    ]

It found the /tmp folder, it found my earlier created deleteme folder and its text-file. But it does not want to get that file and i do not understand why.

Does anyone know what i might have done wrong?

0

There are 0 answers