sudo ssh password reading from command line

Helo ansible list,

is there is a way to set sudo password from cli or variable in a playbook to permit batch mode without prompting?

thanks in advance

jean-marc

Hi Jean-Marc,

There is not a way to do this. The suggested approach is to enable password-less sudo on your target machines instead of storing or saving the password on the Ansible machine.

Thanks,

Tim

If you use -K (ask sudo passwd) it will hold the password in memory, and use it on each host as it is asked for pass. Assumes one user/pass for all the hosts being affected by that run of course.