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,230 points
10,288 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,440 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,440 points
13,265 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 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,440 points
2,069 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,440 points
2,905 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP