# Cannot get password from a vault file

**URL:** <https://forum.ansible.com/t/cannot-get-password-from-a-vault-file/26936>\
**Category:** Ansible Project\
**Created:** [March 8, 2018, 3:35pm UTC](https://forum.ansible.com/t/cannot-get-password-from-a-vault-file/26936 "2018-03-08T15:35:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JiElPe-Fr38](https://avatars.discourse-cdn.com/v4/letter/j/85f322/32.png) [@JiElPe-Fr38](https://forum.ansible.com/u/JiElPe-Fr38)\
**Post date:** [March 8, 2018, 3:35pm UTC](https://forum.ansible.com/t/cannot-get-password-from-a-vault-file/26936/1 "2018-03-08T15:35:13Z")

</div>

Dear all,

I am really stucked with this problem.  
I have a vault file which is referenced within ansible.cfg and its password is stored in a file referenced on the command line through --vault-password-file.  
This seems to be ok.

My vault contains (silly example for trials):

`jenkins: totototo`

I thought that I had understood that jenkins is considered as a var ( by the way, the file is included through include\_vars), and therefore must be used as {{ jenkins }}.  
And as it is about password used to create a user, the task could be something like :

`

-name: Create Jenkins User  
user:  
name: jenkins  
groups: jenkins  
state: present  
password: “{{ jenkins | password\_hash(‘sha512’) }}”  
comment: “Jenkins Instance user”  
createhome: yes  
home: /home/jenkins  
shell: /usr/bin/bash  
become: yes  
become\_user: root

`

The playbook runs OK.  
But when going into the machine (a VM created with vagrant) through ssh as vagrant user, I cannot run su jenkins. The password _totototo_ is refused.  
Note that if I replace the password line with :  
`*password: "{{ 'totototo' | password_hash('sha512') }}"*`  
I can run a su jenkins with password totototo.

So … what ?

Thanks for your help.  
J-L
