mlissner
mlissner

Reputation: 18166

Synchronize directories on remote host

I want to make a copy of a directory on my remote host. The task I tried to use is:

  - name: copy old core configs to new Solr
    become: yes
    become_user: root
    synchronize:
      src="/usr/local/solr/example/solr/collection1/"
      dest="/usr/local/solr-4.10.4/example/solr/collection1"
      recursive=yes
    delegate_to: "{{ inventory_hostname }}"

But it seemed like it was hanging forever and looking in iotop it didn't seem like anything was being copied. What I expect this to do is SSH into the remote host, and do an rsync from one directory to the other. Am I missing something?

Upvotes: 0

Views: 4297

Answers (1)

Henrik Pingel
Henrik Pingel

Reputation: 3193

You are mixing YAML syntax styles by using = instead of :. In my experience this can cause misleading errors.

Try:

- name: copy old core configs to new Solr
  become: yes
  become_user: root
  synchronize:
    src: "/usr/local/solr/example/solr/collection1/"
    dest: "/usr/local/solr-4.10.4/example/solr/collection1"
    recursive: yes
  delegate_to: "{{ inventory_hostname }}"

Upvotes: 4

Related Questions