On Tuesday, August 16, 2016 at 12:46:19 PM UTC-7, Josh Smift wrote:
>
> JBS> How do you use the synchronize module to copy files from one play to
> JBS> another on localhost? Is there a way to change the dest host to
> localhost?
>
> On further reflection, I sort of think there isn't. In any invocation of
> the module, you're going to have a source host and a destination host, and
> you can use delegate_to to change one of them, but there's no obvious way
> to tell it *which* one of them (so it's always the source host).
>
> It'd be nice if you could just tell the module what to use as the source
> host and the destination host; the current behavior where it defaults to
> the control host and the remote host is probably good for many use cases,
> but there are also cases where you want to do entirely different things.
>
> Should I make a feature request ticket for that?
>
> synchronize already does things very differently than any other ansible
module. I'm afraid this would be too much. To do what you want, you'll
need to put a second play into your playbook like this:
- hosts: all
become: True
gather_facts: False
tasks:
- local_action: copy src=/tmp/foo.txt
dest=/tmp/wip/{{inventory_hostname}}.txt
- hosts: localhost
become: True
gather_facts: False
tasks:
- local_action: synchronize src=/tmp/wip/ dest=/tmp/real
-Toshio
--
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/282f1806-4bf6-4193-ba2c-ef3ddae2cafe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.