Ansible - remote_src parameter
by
Jeremy Canfield |
Updated: October 14 2022
| 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