synchronize module and delegate_to: seems to not respect become_user ansible 2.3.1.0

22 views
Skip to first unread message

dogfish182

unread,
Aug 8, 2017, 3:06:48 AM8/8/17
to Ansible Project
Hi All 

ansible 2.3.1.0

seems to not respect the become_user in the following play. 
#note that this below jams up because it expects accounts and ssh keys as it uses rsync underwater. Figure that out then remove this comment
- name: copy dump to remote
become: false
become_user: fresh-dbs
synchronize:
mode: push
src: "{{ hostvars['192.168.56.100'].dbdump.stat.path }}"
dest: /tmp/restore.sql
delegate_to: 192.168.56.100
tags: rsync
My expectation on the above is that on the delegate host, the rsync job should trigger as the user 'fresh-dbs' (which is created and key'd earlier in the play
and can login to the target.

What really happens is that it just runs as my ansible control user and fails out.

Anyone know how to elegantly deal with this? I want to copy a file from one host to another without using the control machine.

Kai Stian Olstad

unread,
Aug 8, 2017, 8:57:17 AM8/8/17
to ansible...@googlegroups.com
On 08. aug. 2017 09:06, dogfish182 wrote:
> ansible 2.3.1.0
>
> seems to not respect the become_user in the following play.
> #note that this below jams up because it expects accounts and ssh keys as
> it uses rsync underwater. Figure that out then remove this comment
> - name: copy dump to remote
> become: false
> become_user: fresh-dbs
> synchronize:
> mode: push
> src: "{{ hostvars['192.168.56.100'].dbdump.stat.path }}"
> dest: /tmp/restore.sql
> delegate_to: 192.168.56.100
> tags: rsync
> My expectation on the above is that on the delegate host, the rsync job
> should trigger as the user 'fresh-dbs' (which is created and key'd earlier
> in the play
> and can login to the target.

To use become_user you need to set become: true

--
Kai Stian Olstad

dogfish182

unread,
Aug 9, 2017, 3:52:28 AM8/9/17
to Ansible Project
Ah, bad paste job on that one I've been experimenting with every different combination. Become is set to try and the result is the same. Doesn't work
Reply all
Reply to author
Forward
0 new messages