1
votes

I am trying to copy directories on remote machine using Ansible.

It throws "msg": "Remote copy does not support recursive copy of directory:" error.

below is my ansible playbook.

  • name: Copy Juddi depenedent directories copy: src: "{{ source_vm}}/{{ item }}" dest: "{{ destination_vm }}/" remote_src: yes with_items: - "dir1" - "dir2" - "dir3"

Can anyone please help me?

1

1 Answers

1
votes

You can use the synchronize module https://docs.ansible.com/ansible/latest/modules/synchronize_module.html#examples and just replace copy with synchronize.

Read the example link above. For two directories on one remote host use:

- name: Synchronize two directories on one remote host.
  synchronize:
    src: /first/absolute/path
    dest: /second/absolute/path
  delegate_to: "{{ inventory_hostname }}"