# Encrypt service\_account\_file for Dynamic Inventory

**URL:** <https://forum.ansible.com/t/encrypt-service-account-file-for-dynamic-inventory/30352>\
**Category:** Ansible Project\
**Created:** [May 16, 2019, 7:08pm UTC](https://forum.ansible.com/t/encrypt-service-account-file-for-dynamic-inventory/30352 "2019-05-16T19:08:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_Blong](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Sean\_Blong](https://forum.ansible.com/u/Sean_Blong)\
**Post date:** [May 16, 2019, 7:08pm UTC](https://forum.ansible.com/t/encrypt-service-account-file-for-dynamic-inventory/30352/1 "2019-05-16T19:08:39Z")

</div>

Is there a way, or possibly a workaround, to encrypt the service\_account\_file that is used by a dynamic inventory? For instance, I’m using the gcp\_compute inventory plugin and have a dynamic inventory YAML file that looks like this:

`  
plugin: gcp\_compute  
projects:

- \<project\_name\>  
filters:  
auth\_kind: serviceaccount  
service\_account\_file: svc-acct-key.json  
`

The service account file (i.e. svc-acct-key.json) has sensitive data that should be encrypted and so I’ve encrypted that file using Ansible Vault. I was expecting this inventory file to be run and when it attempts to fetch svc-acct-key.json I was expecting it to decrypt the file, but instead it reads the file in encrypted format and complains that it is not properly formatted JSON. Is there a workaround to get this to work? Ideally I would like to use Ansible Vault since I’m already using this for passwords. Please advise.

Thank you,

Sean
