Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Become

Direct answer

Ansible become changes privilege context for tasks through a supported escalation method, separating connection identity from the identity under which the target action executes.

When to use this

Use it when configuring, checking or troubleshooting Become in Ansible.

First 30 seconds

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.

Operational verification

task → become → privileged execution

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Ansible automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformAnsible automation · Become owns Ansible privilege-escalation invocation. sudo/UAC/IAM policy internals remain in Security/OS domains.
Scope / prerequisiteUse it when configuring, checking or troubleshooting Become in Ansible.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

4 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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: true on every task.
  • Wrong become_method on network devices (use enable).
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 references

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.

observation · 1
Key points
  • 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.
Key checks
  • ansible <h> -m command -a 'id' -b — become test
  • sudo -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
SettingMeaning
become_userTarget user (default root)
become_methodsudo, 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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docAnsible automation current

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%
Terminology layer

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.

Aliases that resolve here
ansible becomesudo ansiblebecome_userprivilege escalation
Embedded reference data

Quick lookup tables

Become Ansible boundary map

Fast input/selection, execution/result and target-proof boundaries for Become.

BoundaryHealthy evidenceSuspicious evidence
Inputs / selectionCorrect inventory, hosts, variables/facts and content are explicitWrong scope, stale facts, hidden precedence or content-version drift
ExecutionConnection, privilege, module/task context and ordering match intentUnreachable, wrong execution host, privilege/plugin failure or misleading skip/change state
Result semanticsPer-host/item results are preserved and interpreted correctlyAggregate recap hides partial/skipped/handled failures
Target proofResource/workload read-back and rerun confirm convergenceGreen Ansible status treated as end-to-end acceptance
Depth when you need it

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.

Confirmation

Confirm action

Continue?