# How to add password variables?

**URL:** <https://forum.ansible.com/t/how-to-add-password-variables/20987>\
**Category:** Ansible Project\
**Created:** [March 25, 2016, 1:54pm UTC](https://forum.ansible.com/t/how-to-add-password-variables/20987 "2016-03-25T13:54:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gilberto\_Valentin](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@Gilberto\_Valentin](https://forum.ansible.com/u/Gilberto_Valentin)\
**Post date:** [March 25, 2016, 1:54pm UTC](https://forum.ansible.com/t/how-to-add-password-variables/20987/1 "2016-03-25T13:54:39Z")

</div>

I have a task that calls a root password from my vault.yml by adding it to the task as:

`vars: ansible_become_pass:"{{ root }}"`

However, I have to use it multiple times within my tasks/main.yml. Is is possible to add that variable once to vars/main.yml

Here is what my tasks/main.yml looks like:

`

---

<div class="post-metadata">

**Author:** ![Gilberto\_Valentin](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@Gilberto\_Valentin](https://forum.ansible.com/u/Gilberto_Valentin)\
**Post date:** [March 25, 2016, 4:09pm UTC](https://forum.ansible.com/t/how-to-add-password-variables/20987/2 "2016-03-25T16:09:55Z")

</div>

OK, I figured this out. I added the following to my site.yml:

`

- name: install app to all test servers  
hosts: testservers  
become: yes  
user: service\_account  
vars\_files:
- vault.yml  
vars:  
ansible\_become\_pass: “{{ root }}”

roles:

- pb\_install\_test

`
