# How to add become password in a task?

**URL:** <https://forum.ansible.com/t/how-to-add-become-password-in-a-task/26031>\
**Category:** Ansible Project\
**Created:** [November 15, 2017, 1:27pm UTC](https://forum.ansible.com/t/how-to-add-become-password-in-a-task/26031 "2017-11-15T13:27:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZillaYT](https://avatars.discourse-cdn.com/v4/letter/z/4da419/32.png) [@ZillaYT](https://forum.ansible.com/u/ZillaYT)\
**Post date:** [November 15, 2017, 1:27pm UTC](https://forum.ansible.com/t/how-to-add-become-password-in-a-task/26031/1 "2017-11-15T13:27:19Z")

</div>

I’ve read the docs and it seems like all of them point me to coding the p/w either on the CLI or in group vars, but I want to do this

`

---

<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:** [November 15, 2017, 2:21pm UTC](https://forum.ansible.com/t/how-to-add-become-password-in-a-task/26031/2 "2017-11-15T14:21:13Z")

</div>

What works is in the documentation.  
The reason you don't find something like this in the documentation is because the feature doesn't exist.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [November 15, 2017, 7:12pm UTC](https://forum.ansible.com/t/how-to-add-become-password-in-a-task/26031/3 "2017-11-15T19:12:52Z")

</div>

This can still be done, you can set the ansible\_become\_password variable using the vars argument like so;

- command: whoami  
&nbsp;&nbsp;become: yes  
&nbsp;&nbsp;become\_user: user  
&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;ansible\_become\_password: password

The vars key can be used to set any variable for that particular task and it can even include ansible\_become\_user if you want to override the host variable if set where become\_user is just a fallback.

Thanks

Jordan
