Use synchronize module with user different than ansible_ssh_user

1,194 views
Skip to first unread message

Jacek Bzdak

unread,
Nov 24, 2013, 6:57:05 PM11/24/13
to ansible...@googlegroups.com

My playbook consists of two steps:
  • Setup remote user (one of possibly many), and do stuff that require root
  • Login to this user and do rest without privileges

It seems that synchronize module doesn't play well with it. It seems that it tries to login to ansible_ssh_user despite the fact that I specified remote_user. This might be a bug, or just simple misunderstanding from mu side. In any case could you please tell me how to make it work?

Here is excerpt from the playbook:

---
- hosts: test
  remote_user: "{{experiment.username}}"
  vars:
    experiment:
      username: attenuation
  tasks:
    - name: sync
      synchronize: dest=/home/{{experiment.username}}/.pythonz/ src=../local-repo/silf-deploy-big-files/pythonz-{{ansible_architecture}}

Here is the output:

TASK: [sync] ******************************************************************
failed: [test_ansible] => {"cmd": "rsync --delay-updates --compress --timeout=10 --archive --rsh 'ssh  -o StrictHostKeyChecking=no' --out-format='<<CHANGED>>%i %n%L' ../local-repo/silf-deploy-big-files/pythonz-x86_64 ans...@192.168.56.90:/home/attenuation/.pythonz/", "failed": true, "rc": 12}
msg: rsync: mkdir "/home/attenuation/.pythonz" failed: Permission denied (13)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

Here is revelent host 

[test]
test_ansible ansible_ssh_host=192.168.56.90 ansible_ssh_user=ansible

Michael DeHaan

unread,
Nov 25, 2013, 1:45:02 PM11/25/13
to ansible...@googlegroups.com
What is "ansible --version" ?




--
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 ansible-proje...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Michael DeHaan <mic...@ansibleworks.com>
CTO, AnsibleWorks, Inc.
http://www.ansibleworks.com/

Jacek Bzdak

unread,
Nov 27, 2013, 5:20:04 PM11/27/13
to ansible...@googlegroups.com
I use current version:

$ ansible --version
ansible 1.4

PS. I somehow missed your response.
Reply all
Reply to author
Forward
0 new messages