<p dir="auto">For example, I have a playbook named remotesetup.yml and I run it from the command line like that:</p>
<p dir="auto">ansible-playbook remotesetupp.yml -K</p>
<p dir="auto">It will ask for the sudo password even if the file doesn't exist (I made a typo, two p at the end).<br>
In the same way, if there's a yaml syntax error in the playbook it will still ask me for the sudo pass even though it can't run the playbook.</p>
<p dir="auto">Thus, the parsing of the playbook should be done prior to asking for sudo or ssh pass.</p>
<p dir="auto">Let met present you the following example :</p>
<p dir="auto">sandboxy.yml playbook</p>
<hr>
<ul dir="auto">
<li>hosts: backup<br>
sudo: True<br>
sudo_user: david<br>
gather_facts: False</li>
<li>hosts: main<br>
sudo: True<br>
sudo_user: foofoo<br>
gather_facts: False</li>
</ul>
<p dir="auto">When I run ansible-playbook sandbox.yml -K</p>
<p dir="auto">It correctly asks me for the first sudo password but then when it reaches the second playbook with the host main it hangs because it tries to apply the first specified sudo password to foofoo@main.</p>
<p dir="auto">Thanks.</p>