I hit a snag using “become/sudo”. I can become/sudo to the root user if the prompt that is returned is as expected (I think). For example, here is the default prompt.
[sudo] password for testuser:
I think Ansible expects some variation of the prompt above to which it sends the become/sudo password.
If the prompt looks like below (its still a sudo prompt, just not the default)
enter PASSCODE:
become/sudo will fail. I think its because the module, whatever module/code that it is, expects a return prompt similar to the default.
I would like to edit the file that expects this prompt to allow for the additional return prompt. I don’t know which .py file that would be. I am open to other suggestions. I reviewed the vars_prompt documentation, but I am not sure how I would set it.
I’m afraid it is not entirely true. I suffer from this issue as well.
I have a few machines that are centrally managed and the sudo password prompt is set to a fixed string. This setting overrides what Ansible or command line invocation specifies with -p flag. The other part of the problem is that Ansible does not handle if I specify my own prompt with the sudo_flags in the configuration file - it will use two -p flags on the final command (like: -p “from config” -p “generated”) which still won’t match the string in my case. Is there another way to handle this issue?