A task needs root on the target but your user has only limited sudo rights.
IntermediateScenarioSecurity: Vault, Become and Compliance
Answer
Situation read → Least-privilege become.
What I'd do →
- Scope
becometo tasks that need it, not the whole play. - Ask ops to give a sudoers drop-in for specific commands if possible.
- Use
become_userfor service accounts.
- ansible.builtin.command: systemctl restart app
become: true
- ansible.builtin.command: /opt/app/bin/report
become: true
become_user: appsvc
Why → Minimal escalation reduces blast radius and audit scope.
Interview tip → NOPASSWD for a service account over a fixed command list is the production norm.
More on Security: Vault, Become and Compliance
Database passwords are sitting in plain text in `group_vars`. How do you fix it?BeginnerYou need separate vault passwords for staging and prod.IntermediateHow do you change the vault password for all encrypted files?IntermediateA CI pipeline needs the vault password without storing it in the repo.IntermediateYou want to see the value inside an encrypted file without writing a decrypted copy to disk.BeginnerOnly one value in a vars file is secret and you want it in the same file as plain values.Beginner