# Ansible Vault with Ansible 2.0.0.2 copying encrypted files to server

**URL:** <https://forum.ansible.com/t/ansible-vault-with-ansible-2-0-0-2-copying-encrypted-files-to-server/21049>\
**Category:** Ansible Project\
**Created:** [April 3, 2016, 1:11pm UTC](https://forum.ansible.com/t/ansible-vault-with-ansible-2-0-0-2-copying-encrypted-files-to-server/21049 "2016-04-03T13:11:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ash\_Matadeen](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Ash\_Matadeen](https://forum.ansible.com/u/Ash_Matadeen)\
**Post date:** [April 3, 2016, 1:11pm UTC](https://forum.ansible.com/t/ansible-vault-with-ansible-2-0-0-2-copying-encrypted-files-to-server/21049/1 "2016-04-03T13:11:30Z")

</div>

Has anyone else experienced this issue with ansible vault when provisioning?

The task:

- name: set up bitbucket key  
copy: src=roles/users/files/{{ item.username }}/bitbucket dest=/home/{{ item.username }}/.ssh/bitbucket owner=ash group=ash mode=0644  
with\_items: users

“src=roles/users/files/{{ item.username }}/bitbucket” is a file encrypted with ansible vault and is the only encrypted file in the playbook.

Provisioning with:  
`ansible-playbook -i ansible/production_inventory -l webservers ansible/playbook.yml --vault-password-file=~/.ansible_vault_pass.txt`  
does copy the file to the server but the file remains encrypted.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 4, 2016, 1:55pm UTC](https://forum.ansible.com/t/ansible-vault-with-ansible-2-0-0-2-copying-encrypted-files-to-server/21049/2 "2016-04-04T13:55:30Z")

</div>

Currently vault only works for variables, not actual files being copied. There are a couple of pull requests that implement this in the queue.

The way to currently make this work, is to assign the content of the files into a variable that is then put in an encrypted vars file and use the `copy: content='{{varname}}' ...`.

---

<div class="post-metadata">

**Author:** ![Ash\_Matadeen](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Ash\_Matadeen](https://forum.ansible.com/u/Ash_Matadeen)\
**Post date:** [April 5, 2016, 9:06am UTC](https://forum.ansible.com/t/ansible-vault-with-ansible-2-0-0-2-copying-encrypted-files-to-server/21049/3 "2016-04-05T09:06:43Z")

</div>

Thanks Brian, that all makes sense now!
