Modifying local files while targeting a remote system
25 views
Skip to first unread message
EspressoBeanies
unread,
Nov 7, 2017, 2:12:59 PM11/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Is it possible to modify local files while targeting a remote system in an Ansible YAML file? I'm trying to run an Ansible script on a remote machine, but when everything finishes on that remote machine, I'd like to move that hostname from one Ansible hosts file to another. Is it possible and if so, could someone point me in the right direction? Thanks!
Kai Stian Olstad
unread,
Nov 7, 2017, 2:19:48 PM11/7/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
On all task you can use delegate_to[1] and that task will run on the delegated machine.
So "delegate_to: localhost" will run on local machine and not on the remote host.
To change a file you have the lineinfile module or the template module.