1
votes

Ansible automated script:

tasks:
     - name:  copying catalina.out to /tmp/jagthish location
       fetch:
          src:
            - yes
            - /usr/tomcat/tomcat8/logs/catalina.out
          dest: /tmp/jagthish/

error message:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'startswith'
fatal: [ip]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}

I tried to copy a file (catalina.out) from remote server to my local server. it shows above error.

1

1 Answers

1
votes

You can't provide a list to the src argument of fetch module. It expects a path to a file in a string.

You seem to want this:

- name:  copying catalina.out to /tmp/jagthish location
  fetch:
    src: /usr/tomcat/tomcat8/logs/catalina.out
    dest: /tmp/jagthish/
    flat: yes