Sync folder from remote permissions denied

58 views
Skip to first unread message

Anatol

unread,
Mar 21, 2015, 10:55:29 AM3/21/15
to ansible...@googlegroups.com
Hi,

I´d like to sync logfiles from a remote ubuntu 12.04 server to my local computer:

That´s what my Playbook looks like:

- hosts: "{{targets}}"
  vars
:
     remote_user
: "{{username}}"
  tasks
:

   
- name: Synchronize log files
      synchronize
:  src=/var/log/apache2/ dest=/Users/me/Desktop/logs/ mode=pull
      sudo
: yes

unfortuntely it fails with:

msg: sudo: no tty present and no askpass program specified
Sorry, try again.

If I run the playbook without sudo:yes I get a permission denied as the specified user is not member
of root or adm group.

(That´s what the Remote Folder looks like )

drwxr-x---  3 root   adm        12288 Mar 15 06:25 apache2


I think a workaround could be to add the user to root or adm group or change chmod of the remote folder,
but this is a kind of ugly. Is there a way to grant rights (sudo -i)  to the user via ansible?

best,

anatol

Anatol

unread,
Mar 21, 2015, 12:35:31 PM3/21/15
to ansible...@googlegroups.com
As I disabled root access from ssh, I´ve ended up adding the user to adm group

sudo usermod -aG adm <user>

and exluded a file which belongs to root

      synchronize:  src=/var/log/apache2/ dest=/Users/me/Desktop/logs/ mode=pull rsync_opts=--exclude=.elinks


Reply all
Reply to author
Forward
0 new messages