become

The Ansible keyword that switches on privilege escalation, so a task or a whole play runs as another account, root by default.

In more detail

Set become: true on a play and every task in it escalates; set it on a task and only that task does. become_user says who to become, and setting it without become: true is the classic mistake that ansible-lint catches. Setting become: false explicitly in a play that must not need privilege turns an accident into a clear failure.

Example

become: true
become_user: app

Related terms

Taught in

References

Certification courses