You may want to add the
--ask-become-pass option to your command line. This will cause ansible to prompt you for a password before running your playbook. The password needs to be the one your
ansible_ssh_user would type on the remote systems when running a command with
sudo. Obviously, the same
ansible_ssh_user needs to have permission to run
sudo on all remote systems.
Quoting from https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html:
When speaking with remote machines, Ansible by default assumes you are using SSH keys. SSH keys are encouraged but password authentication can also be used where needed by supplying the option
--ask-pass. If using sudo features and when sudo requires a password, also supply
--ask-sudo-pass which has been deprecated).
As the above quote suggests, there are better ways to do this.
For future reference, please note:
- Do not attach screenshots of error messages or log output, especially since it's much easier to just copy and paste the text directly. But mostly, because screenshots are unsearchable. Your future self will thank you when you are stumped by the same error again and will find your own post with google.
- When you copy and paste error messages or text files such as yaml, please format them properly before posting.