ansible copy multiple files

Ansible copy multiple files

To copy the files from ansible master control machine to remote target servers, we use ansible copy module. In the following examples i will show you how to copy multiple files using ansible copy module.

Here it will copy the file from ansible master to remote target servers. We know that in ansible copy module, we use two parameters one is src, another one is dest. SRC represents source file path or path of the file which we are going to copy. DEST represents the destination path on the remote server. In this example we are copying devops.conf file from ansible master machine to remote server(target machine) etc directory. With ansible copy we can copy multiple files.

Ansible copy multiple files at once

In this example we are copying multiple files from ansible master machine to remote server. But in this example we are copying all the files from devops directory to remote server rundeck directory.

Ansible copy multiple files to multiple destinations

Here you can see we are copying multiple files to multiple destinations by using with_items. In this example we are copying three(3) files from different locations to different locations in remote server. Jboss.conf is copying to jboss directory, rundeck.conf is copying to rundeck directory and httpd.conf is copying to httpd directory.

 

  • ansible copy multiple files
  • copy ansible multiple files
  • multiple files ansible copy
  • multiple files copy ansible