Synchronize via sudo -- no tty present and no askpass program specified

Hello, I have seen many similar topics but want to make sure my issue is the same.

Our enterprise is taking a look at Ansible to handle non-root tasks. I am trying to use the synchronize module but having many issues getting it to work with sudo.

Assume no root access, and the maintenance user we can connect with has SUDO to other users.

Task:

  • name:
    when: app_user|default(None) != None
    become: yes
    become_user: “{{ app_user }}”
    become_method: sudo
    synchronize: src=x dest=/app//{{ app_user }}/testx

Fails with this error:

msg: sudo: no tty present and no askpass program specified
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

Any ideas?

I have tried messing with the rsync_path –

I dont want to mess around too much as I am afraid my sudo password I type in will end in plain text somewhere.

Hello Johue,

I ended up turning sudo to NOPASS during the action and resetting it afterwards.

Regards
Mirko

This will not work for us. We have to give the password as part of our security rules.

在 2015年10月5日星期一 UTC+8下午11:59:55,johhue写道:

Any Ideas, I met the same issue