Call /etc/sudoers commands from fabric
In my /etc/sudoers I have:
# Allow the picky user to restart its own gunicorn process
picky ALL=(ALL) NOPASSWD: /usr/bin/supervisorctl restart picky
I can indeed run this command from the picky user:
$ su picky
$ sudo supervisorctl restart picky
In my fabfile.py I have the following:
from fabric.api import sudo
def restart():
sudo("supervisorctl restart picky")
However, when I run my fabric file, it still prompts for a password:
[picky@myhost] sudo: supervisorctl restart picky
[picky@myhost] out: sudo password:
How can I run sudo commands inside Fabric such that I don't need to
provide a password?
No comments:
Post a Comment