Missing sudo password

I’m trying to run ad-hoc command and use privilege access to run the command here is what I try to running :

ansible localhost -m service -a "name=httpd state=started" -b -k

After I enter my SSH password I get bellow message:

SSH password:
127.0.0.1 | FAILED! => {
    "msg": "Missing sudo password"
}

any one have had this issue before?

You need to add “-K” for asking the become password. It will re-use the ssh password if you leave it blank, but it is a required flag if a password is required for your become method.

1 Like

Thanks , It is working now , I thought is small “k”

ansible --help

extract:

-K, --ask-become-pass   ask for privilege escalation password

-k, --ask-pass        ask for connection password

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.