# Encrypt private\_key\_file ?

**URL:** <https://forum.ansible.com/t/encrypt-private-key-file/21454>\
**Category:** Ansible Project\
**Created:** [May 17, 2016, 10:56am UTC](https://forum.ansible.com/t/encrypt-private-key-file/21454 "2016-05-17T10:56:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregor1](https://avatars.discourse-cdn.com/v4/letter/g/87869e/32.png) [@Gregor1](https://forum.ansible.com/u/Gregor1)\
**Post date:** [May 17, 2016, 10:56am UTC](https://forum.ansible.com/t/encrypt-private-key-file/21454/1 "2016-05-17T10:56:14Z")

</div>

I’d like to put the private key file I ssh into many of my machines with into my repo. When I encrypt the file with the ssh-key in it using ansible-vault, I can easily edit, show etc. the file with ansible-vault when I provide a vault\_password\_file in the ansible.cfg.  
However, when trying to run a playbook with the same ansible.cfg, it always prompts me for the password again. So the commands I run:

ansible-vault show keys/mykey.pem //works fine like that, because password is provided in a vault\_password\_file  
ansible-playbook -i contrib/inventory/ec2.py myplaybook.yml //suddenly prompts me with 'Enter passphrase for key 'keys/mykey.pem". When I enter the password, it is rejected.

Anybody know what’s going on there?
