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.

thenetimp
  • 231
  • 2
  • 3
  • 12

3 Answers3

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.

sebix
  • 4,313
  • 2
  • 29
  • 47
thenetimp
  • 231
  • 2
  • 3
  • 12
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

sebix
  • 4,313
  • 2
  • 29
  • 47
-1

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

ask_sudo_pass= true
sebix
  • 4,313
  • 2
  • 29
  • 47
Jishnu Kinwar
  • 181
  • 1
  • 1