I am trying to use ansible, but I seem to not be able to get it to work with sudo. I have minimised the problem to this:
This does not work:
ansible localhost --ask-become-pass -m shell -a "cat /var/log/syslog"
Gives this output: I type password, then it errors.
SUDO password: localhost | FAILED | rc=1 >> cat: /var/log/syslog: Permission denied
These work fine:
ssh -t localhost sudo cat /var/log/syslog #without ansible ansible localhost -m shell -a "ls" #without sudo
#expecting last line to be `root` ansible localhost --become-user=root --ask-become-pass -m shell -a "whoami"
gives this output, when correct password entered.
SUDO password: localhost | SUCCESS | rc=0 >> richard