run command on ansible host with sudo privilege.

43 views
Skip to first unread message

Kevin Parent

unread,
Oct 15, 2016, 1:00:12 AM10/15/16
to Ansible Project
Hi guys, I am using:

- hosts: 127.0.0.1
  connection: local

to execute command on the ansible host, I disabled privilege escalation because I would get an error message:

"module_stderr": "sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

Im trying to execute the command: npm install --production. but some of the packages requires sudo permission to be installed

So now what?

:(.

Brian Coca

unread,
Oct 20, 2016, 12:28:58 AM10/20/16
to ansible...@googlegroups.com
Can you sudo normally on your machine?

You can also use su or other methods if sudo is not available on your machine, or execute the ansible itself as root.


----------
Brian Coca

Vipul Vadoliya

unread,
Oct 20, 2016, 1:00:45 PM10/20/16
to Ansible Project

   become_user: root
   become: true
   become_method: sudo
Reply all
Reply to author
Forward
0 new messages