Bootstrap FreeKB - Ansible - remote_src parameter
Ansible - remote_src parameter

Updated:   |  Ansible articles

By default, some modules will be run on the control node (that's your Ansible server). For example, the default behavior of the copy module is to copy a file or directory from the control node (that's your Ansible server) to the managed nodes (e.g. target systems). The remote_src parameter can be used to perform the task on the managed node (the target system). In this example, the /root/foo.txt file on the managed node will be copied to /tmp/foo.txt on the managed node.

---
- hosts: all
  tasks:
  - name: copy /root/foo.txt to /tmp/foo.txt
    copy:
      src: /root/foo.txt
      dest: /tmp/foo.txt
    remote_src: true
...

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter cb3d94 in the box below so that we can be sure you are a human.