Interview Prep/Ansible/Security: Vault, Become and Compliance

A sudo password is required on the targets. How does Ansible get it without prompting each time?

BeginnerScenarioSecurity: Vault, Become and Compliance
Answer

Situation read → Interactive become password.

What I'd do → Use -K (--ask-become-pass) interactively, or supply ansible_become_password from Vault in unattended runs. Better, use passwordless sudo restricted to needed commands for the automation user.

Why → Prompting breaks automation; plain text breaks security; vault or sudoers rules are the compromise.

Interview tip → AWX stores it in a credential.

All Ansible questions Roadmap: Ansible

More on Security: Vault, Become and Compliance