Use it when configuring, checking or troubleshooting Become in Ansible.
Become
Ansible become changes privilege context for tasks through a supported escalation method, separating connection identity from the identity under which the target action executes.
1. become escalates privileges (sudo, su, runas).
2. Use only where needed.
3. Limit sudo rules for automation user.
4. Avoid NOPASSWD ALL if possible.
5. Log privileged actions.
task → become → privileged execution
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
connection identity → transport auth → become config → target privilege policy → effective execution identity → task action → resource read-back
Healthy evidence: login and escalation identities are explicit, policy permits the intended noninteractive action and effective permissions match requirements.
Step 2 Failure modes and next checks Narrow the fault
Suspicious evidence: works manually but not via Ansible, password prompt deadlock, wrong become user/method, overbroad sudo or confusing connection auth with escalation.
Step 3 Common mistakes Narrow the fault
become: trueon every task.- Wrong
become_methodon network devices (useenable).
Step 4 Where it fails Narrow the fault
Where Become usually goes wrong: privilege escalation identity, method/user scope, credential handling and command authorization.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Connection authenticated ≠ become authorized; login and privilege escalation are separate boundaries.
- become: true ≠ root necessarily; become_user and platform method determine effective identity.
- Sudo command works interactively ≠ noninteractive Ansible become works with same policy.
- Privilege escalation success ≠ task safe; authorization does not validate intended change.
ansible <h> -m command -a 'id' -b— become testsudo -l -U <automation-user>— sudo rights on target- become_method/become_user — config
ReferenceWhat it is1 section · depth on demand
Core model
Validate remote login identity, become method/user, authorization policy, password/credential source, noninteractive behavior and final effective privilege at the failing task.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Successful become shows escalation to the configured execution context for that action, but it does not show the action itself or wider target state is correct.
In depth
become is Ansible's privilege escalation: tasks run as another user (usually root) using sudo, su, runas or a network device's enable mode.
- hosts: linux
become: true
tasks:
- ansible.builtin.package: { name: chrony, state: present }
# network devices
- hosts: ios
vars:
ansible_become: true
ansible_become_method: enable
| Setting | Meaning |
|---|---|
become_user | Target user (default root) |
become_method | sudo, su, runas, enable |
--ask-become-pass (-K) | Prompt for password |
Grant the automation account sudo rights only for what it needs, and avoid passwordless root where possible.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Ansible > Become. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/ansible/latest/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Become Ansible boundary map
Fast input/selection, execution/result and target-proof boundaries for Become.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Inputs / selection | Correct inventory, hosts, variables/facts and content are explicit | Wrong scope, stale facts, hidden precedence or content-version drift |
| Execution | Connection, privilege, module/task context and ordering match intent | Unreachable, wrong execution host, privilege/plugin failure or misleading skip/change state |
| Result semantics | Per-host/item results are preserved and interpreted correctly | Aggregate recap hides partial/skipped/handled failures |
| Target proof | Resource/workload read-back and rerun confirm convergence | Green Ansible status treated as end-to-end acceptance |
Deep reference
Healthy vs suspicious evidence
Output interpretation
For Become, rely on structured fields and stable IDs (privilege escalation identity, method/user scope, credential handling and command authorization) rather than text formatted for display.