hat
hat

Reputation: 1

using with_items in a shell command in ansible

I have the following task inside an Ansible playbook. I simply want to copy 4 dirs from a remote location (server2) to the same path on the target node (server1)

When running the playbook (using tower) when it reaches this task it just hangs, there is no debug information even on the highest verbosity it only shows tower connecting then nothing further

- name: "Copy files from {{ server2 }}"
  become: "{{ appuser }}"
  shell: "scp -pr {{ appuser }}@{{ server2 }}:{{ item }} {{ item }}"
  with_items:
    - /opt/dir1
    - /opt/some/otherdir
    - /opt/directory
    - /opt/another/folder

to answer expected questions:

Additional Notes

only server1 is connected to ansible, server2 is not, it is truely remote, consider it a 3rd party.

Upvotes: 0

Views: 1135

Answers (1)

hat
hat

Reputation: 1

This was resolved by removing the -p from scp, I am unsure why this fixed it!

Upvotes: 0

Related Questions