how do i copy files and sub folders recursively from one location to another location on remote machine by using ansible?

0 votes
[web]
server1
server2
main.yaml
- hosts: web
tasks:
- name: copy files on remote machine
  synchronize:
   src: /home/anil/anilfolder/
dest: /home/anil/anilbackup/
delegate_to:  "{{ inventory_hostname }}"

i wrote like above. but sometime i got synchronizes error. is any other alternative way to copy files and folders from one location to another location on remote machine.please give the solution as soon as possible

Jun 24 in Ansible by anil

edited Jun 24 by Kalgi 86 views
You're trying to copy a folder from one location to another right? You can achieve the same without using synchronize.
please give  one example if it has another solution

1 answer to this question.

0 votes

Try this:

- hosts: web
  tasks:
  - name: Ansible copy files from a directory to remote server
    copy:
      src:/home/anil/anilfolder/
      dest:/home/anil/anilbackup/
answered Jun 24 by Kalgi
• 39,310 points
by using above playbook,copy the files from source server to destination server.

but my requirement is copy files from one folder to another folder on remote server.

Related Questions In Ansible

0 votes
1 answer

Ansible playbbok to copy files from one node to another remote node

You can create a playbook for copying ...READ MORE

answered Jan 16 in Ansible by Danica
215 views
0 votes
1 answer

Ansible playbook for moving files from one node to another remote node

The best way to do this is: copy ...READ MORE

answered Jan 16 in Ansible by Nigya

edited Jan 18 by Vardhan 812 views
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
113 views
0 votes
1 answer
0 votes
1 answer