How to copy multiple files to remote system using Ansible Playbook

0 votes

Hi Guys,

I have configured Ansible in the local system. I want to copy multiple files to the remote systems using Ansible. How can I do that?

Sep 16, 2020 in Ansible by akhtar
• 38,210 points
4,352 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the copy module in your Ansible playbook. This module can copy one or more files to the remote system. But you need to use the item keyword in your playbook for multiple files as shown below.

- name: Copy files
  copy:
    dest: /etc/yum.repos.d/
    src: files/{{ item }}
  with_items:
  - yum.repo
  - docker.repo
  - K8.repo

answered Sep 16, 2020 by MD
• 95,300 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,300 points
4,540 views
+15 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,450 points
1,259 views
+2 votes
1 answer
0 votes
1 answer

How to copy files in remote system using Ansible?

Hi@akhtar, You need to use the copy module ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,300 points
330 views
0 votes
1 answer

How to start httpd service in a remote system using Ansible?

Hi@akhtar, Ansible has a module named service. This ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,300 points
762 views