On 07. nov. 2017 20:12, EspressoBeanies wrote:
> 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!


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.


[1] https://docs.ansible.com/ansible/latest/playbooks_delegation.html#delegation

-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8087cc10-2712-f6fa-0aaa-291f7cf14781%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to