# waits for password when I don't want it to

**URL:** <https://forum.ansible.com/t/waits-for-password-when-i-dont-want-it-to/32087>\
**Category:** Ansible Project\
**Created:** [January 29, 2020, 5:01pm UTC](https://forum.ansible.com/t/waits-for-password-when-i-dont-want-it-to/32087 "2020-01-29T17:01:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmartin](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@dmartin](https://forum.ansible.com/u/dmartin)\
**Post date:** [January 29, 2020, 5:01pm UTC](https://forum.ansible.com/t/waits-for-password-when-i-dont-want-it-to/32087/1 "2020-01-29T17:01:09Z")

</div>

Hi all.

I have an environment with several hundred unreliable machines. Sometimes they’re just dead, sometimes they’re misconfigured. I always encounter some where the keys in my ssh-agent don’t work and it prompts me to enter the password and it waits for me to hit enter a bunch of times before the play will proceed.

Is there a way to configure ssh or ansible to just fail when this happens? I sometimes will run plays with password auth instead of ssh keys, so I don’t want to completely disable that.

Thanks!  
-Dylan

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [January 29, 2020, 5:32pm UTC](https://forum.ansible.com/t/waits-for-password-when-i-dont-want-it-to/32087/2 "2020-01-29T17:32:31Z")

</div>

You could set ssh to only use keys by setting the variable ansible\_ssh\_common\_args="-o PreferredAuthentications=publickey".  
It's also possible to set the environment variable ANSIBLE\_SSH\_COMMON\_ARGS to the same value.
