Ansible forced sudo prompt issue

Hi,

I encountered a really strange issue when running Ansible 2.2.1 on hosts that are managed centrally and have some restrictions that I have to live with. All hosts are running Ubuntu 14.04
When I run a playbook that uses privilege escalation, the playbook fails with the message "Timeout (12s) waiting for privilege escalation prompt: ". Digging in to the problem I found out that these hosts (the ansible clients) are forced to use special prompt for sudo password. when ansible tries to execute something with sudo, it expects the its own prompt which is generated and passed to the sudo command with the ‘-p’ flag. This is disregarded by the host and th sudo prompt will be the one that is forced by the central policy - which could not be parsed by ansible and the playbook fails.
Since I cannot change the behavior of sudo on these nodes, I looked for an ansible solution. I thought that changing ‘sudo_flags’ in ansible.cfg wil override the prompt string that is created by ansible (fortunately the sudo prompt is a fix string). What I found was that the sudo command passes both the specified -p “Sudo prompt” and the generated -p "[sudo via ansible, key=…] password: " prompts:

sudo -H -S -p "Enter Windows Password: " -p "[sudo via ansible, key=vnwkuazqzmjajpbygijunaukgwowylld] password: "

I searched for other methods to force a fixed string for ansible’s sudo prompt but I could not found any working solution. Is there a way to work around this problem?

Thanks,
Imre

What does your sudoers entry look like?

No, currently Ansible requires overriding the prompt to be able to
match what it expects, which includes a unique string per connection.