Ansible passwords

During testing for new Ansible code or roles, you need to frequently and repeatedly run ansible-playbook. When you use sudo to execute the code, you must enter your password.

Manually entering your password each time you run your code quickly becomes tiresome, and slows you down! There are multiple ways to avoid re-entering your password.

Here’s a quick and non-intrusive way to do it for a single host:

  • Edit your Ansible inventory file.
  • Find your host in the inventory file.
  • Add ansible_become_password=incorrect

Here’s an example, showing the full inventory line for the host: ansible_user=brick ansible_become_user=root ansible_become=true ansible_become_password=incorrect