6

The following task fails on a Vagrant box (ubuntu 12.04 chefless) http://opscode.github.io/bento/

  - name: ensure database is created
    postgresql_db: name={{dbname}}
    sudo_user: postgres

fd

failed: [192.168.78.8] => {"failed": true, "parsed": false}
invalid output was: Sorry, user vagrant is not allowed to execute '/bin/sh -c echo SUDO-SUCCESS-lalargtagydzinzenmftocwaiucrmxuk; /usr/bin/python /tmp/ansible-1392568385.89-150322815243790/postgresql_db' as postgres on cogol-dev.

Will I need to create my own box ?

=== content of /etc/sudoers

Defaults    env_reset
Defaults    exempt_group=sudo
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=NOPASSWD:ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
Max L.
  • 9,774
  • 15
  • 56
  • 86
  • It would be helpful to know what your sudo permissions are on the vagrant box. On your vagrant box, run `grep vagrant /etc/sudoers` and add the output to your question. – Ben Whaley Feb 16 '14 at 17:04
  • I added the whole content of /etc/sudoers – Max L. Feb 17 '14 at 14:08

2 Answers2

6

Probably being late here, but I encountered same error today and resolved it with

username ALL=(ALL) NOPASSWD: ALL

your sudo group missing this ALL in parentheses

dantix
  • 745
  • 1
  • 5
  • 14
0

Pretty sure you must also add sudo: yes below/above the sudo_user param.

rgrinberg
  • 9,638
  • 7
  • 27
  • 44