7

I have a Ubuntu 14.04 virtual machine set up in virtualbox and I am trying to follow these instructions.

https://serversforhackers.com/an-ansible-tutorial

When I get to the module section and try to install nginx with this command. with "local" being set to "localhost" in /etc/ansible/hosts

ansible local -s -m shell -a 'apt-get install nginx'

I get the following error:

localhost | FAILED => Missing become password

I have searched google for a way to get past this, but I do not understand what I am doing wrong.

This was a fresh install of the Server OS, and the only setup was done is in this tutorial.

  • 1
    Sounds like the account you're running as doesn't have sudo privileges. – ceejayoz May 8 '15 at 15:48
  • It does. It's the account made at software installation. I even made it so it doesn't require a password because I thought that may have been related to the problem – thenetimp May 8 '15 at 15:55
  • see my answer to the question, it is related to sudo – thenetimp May 8 '15 at 16:02
7

The problem is related to sudo. In /etc/ansible/ansible.cfg there is a commented out setting called ask_sudo_pass which needs to be uncommented out and set to Yes. Alternatively you can set the group the user belongs to to be able to use sudo without a password, but that's a security risk in my opinion.

2

There was a bug introduced in Ansible 1.9 that may be the cause: ask_sudo_pass in ansible.cfg has no effect #10891

-1

Setting the below parameter in ansible.cfg promoted me to enter the sudo password

ask_sudo_pass= true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.