## TL;DR

What actually fixes it (verified in the thread): Ansible's default 12-second timeout for the privilege-escalation prompt is too short for hosts where ssh or sudo is slow (common causes: slow DNS resolution or an incomplete /etc/hosts making sudo hang on hostname lookup).

## Steps

1. Tasks using become with with_items failed with Timeout (12s) waiting for privilege escalation prompt whenever a single command took longer than 12 seconds, even though the same playbook worked against other hosts. Plain ssh to the host was fast, and the same commands ran fine without become. The failure is the become timeout, not the task itself.

2. What actually fixes it (verified in the thread):

3. Ansible's default 12-second timeout for the privilege-escalation prompt is too short for hosts where ssh or sudo is slow (common causes: slow DNS resolution or an incomplete /etc/hosts making sudo hang on hostname lookup). Raise the timeout in ansible.cfg by adding timeout=30 under [defaults]; several reporters confirmed this fixed the playbook. Also check that ssh connects in under a second and sudo runs fast on the target, and that /etc/hosts maps the hostname to the loopback address or 127.0.1.1, since slow name resolution is the usual root cause.

## When to use

You are seeing this: The situation: Tasks using become with with_items failed with Timeout (12s) waiting for privilege escalation prompt whenever a single command took longer than 12 seconds, even though the same playbook worked against other hosts. Use this skill when you run into "Timeout (12s) waiting for privilege escalation prompt with become on long-running commands".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 127.0.1.1. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Edge cases

- Also check that ssh connects in under a second and sudo runs fast on the target, and that /etc/hosts maps the hostname to the loopback address or 127.0.1.1, since slow name resolution is the usual root cause.
