How can a user with SSH keys authentication have sudo powers in Ansible? [duplicate]

You can either change the sudo config for the user owen with this command:

sudo visudo -f /etc/sudoers

and change the line with user owen to this:

owen ALL=(ALL) NOPASSWD:ALL

then sudo won’t require Ansible to enter the password. Or you could instruct Ansible to ask you for the password with the parameter --ask-become-pass like this:

ansible-playbook site.yml --ask-become-pass

Leave a Comment