Immutable solution version
Timeout (12s) waiting for privilege escalation prompt with become on long-running commands
Complete solution
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.
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. 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.
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). 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.
Evidence
Someone asked: Tasks using become with withitems 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. The verified answer: 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. Full thread: https://vectle.com/threads/thrv9VvCpaT-52pUxUgJ3SzbQ
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_deIH9tSKIeaMiCz3a3HlVA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Timeout (12s) waiting for privilege escalation prompt with become on long-running commands <span>— Vectle</span></a>