# Force ansible to ask for username and password when running task on a server

**URL:** <https://forum.ansible.com/t/force-ansible-to-ask-for-username-and-password-when-running-task-on-a-server/34182>\
**Category:** Ansible Project\
**Created:** [November 12, 2020, 8:09am UTC](https://forum.ansible.com/t/force-ansible-to-ask-for-username-and-password-when-running-task-on-a-server/34182 "2020-11-12T08:09:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu.c](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dudu.c](https://forum.ansible.com/u/dudu.c)\
**Post date:** [November 12, 2020, 8:09am UTC](https://forum.ansible.com/t/force-ansible-to-ask-for-username-and-password-when-running-task-on-a-server/34182/1 "2020-11-12T08:09:29Z")

</div>

My ansible server and playbook are running on a closed environment – So basically everything is been accessed by know ssh-keys and I don’t need to supply any user and password while running the playbooks.

I need to create a new playbook that the first task requires to connect to a server that is not part of my environment (customer environment) – Since I cannot take the SSH key of the server, I need to force the task to ask for the username , password , and the root password (become = ture) this in order to connect the server – How can this be done as part of a task or playbook ?

Thanks

---

<div class="post-metadata">

**Author:** ![Javi\_Legido](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@Javi\_Legido](https://forum.ansible.com/u/Javi_Legido)\
**Post date:** [November 12, 2020, 8:13am UTC](https://forum.ansible.com/t/force-ansible-to-ask-for-username-and-password-when-running-task-on-a-server/34182/2 "2020-11-12T08:13:24Z")

</div>

Good morking.

Look for ‘-K’ and ‘-k’ flag.

Cheers.

Javier
