On 22.05.2018 14:40, Dawid D wrote:
Hello All,
    I would like ask about privileges escalation by sudo.

I need run command on *RemoteMachine*. *User: someone* and *Command:
/usr/local/blah.sh *for example

    suoders file:
someone RemoteMachine =(root)*/usr/local/blah.sh*

Unfortunately I can't give permission to switch root, and *I can't give*
NOPASSWD phrase in sudoers.

    I tried by:
shell: /usr/local/blah.sh
*become: yes*
*become_method: sudo*

    But it is failed because ansible trying switch to user before run
command.

This, the shell module, actually run "sudo /some/python/script" and that script run plain "/usr/local/blah.sh"


    I tried also:
shell: "*sudo* /usr/local/blah.sh"

But this one hanging ansible, because he is waiting for sudo password.

    Is there any possibility to just run command with sudo and provide
password automatically ?

sudo do support -S for reading the password from stdin.


--
Kai Stian Olstad

--
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/e2d492a8f42d2a054b7396251d63663f%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to