NewsCrawler.org

Ansible hangs on Ubuntu 26.04 when sudo asks for a password

Ansible hangs on Ubuntu 26.04 when sudo asks for a password
Image: dev.to

Ubuntu 26.04 uses sudo-rs[1] as its default sudo, a rewrite of the original in Rust. When Ansible needs a become password on such a host, privilege escalation hangs. In the author's tests with ansible-core 2.17.6, each run waited about 12.8 seconds and then failed with a timeout, before any task ran. The cause is that sudo-rs wraps the prompt Ansible requests in its own template and adds a capitalised "Password:", so Ansible's exact match misses it.

The report said the fix landed in ansible-core 2.22.0 and was backported[2] to several branches. The author installed the latest released patch of each branch from PyPI and found the fix only in 2.20 and newer, not in 2.16, 2.18 or 2.19. On a control node running Python 3.11, pip installs ansible-core 2.19.15, which still fails.

Hosts with passwordless sudo, such as cloud-init users with NOPASSWD, were not affected and finished in under 2 seconds. Two workarounds worked: keeping the traditional sudo package installed next to sudo-rs and setting ansible_become_exe=sudo.ws, which took about 1.9 seconds per run. With three affected hosts and Ansible's default of five forks[3], the failure cost about 13 seconds in total; with --forks 1 it cost about 37 seconds.

Repository Ansible github.com

Open source IT automation platform that deploys and configures systems over SSH, without agents on managed hosts, using simple YAML playbooks.

Stars: 71,000Forks: 24,000License: GPL-3.0Updated:

Read the original dev.to

Sources

  • DEV Community top

    Chasing down why Ansible stalled on a fresh Ubuntu 26.04 box

Published: First seen: Читать по-русски

Open as a page