Sunday, August 30, 2020

module_stderr": "sudo: a password is required

 This error appears when we try to run an ansible script with a user that is not enabled for passwordless sudo. 

On this error we have two options with us:

1. Make the user run sudo without a password, for which open /etc/sudoers and put the following line for the user for which passwordless ssh is needed"

Then 

shashwat          ALL=(ALL:ALL) NOPASSWD: ALL

#Note: Add this line to the end of the file


Save and Exit and run the ansible script again.

2. option is to enable ansible to ask sudo password on command line. For which you need to pass parameter

--ask-become-pass or -K 

And this will ask for password on command line and ansible will run sucessfully.

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...