# create an vault in AWX 5.0 multi environment

**URL:** <https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 28, 2019, 6:32am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680 "2019-06-28T06:32:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Nanboe](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Daniel\_Nanboe](https://forum.ansible.com/u/Daniel_Nanboe)\
**Post date:** [June 28, 2019, 6:32am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680/1 "2019-06-28T06:32:20Z")

</div>

Hi can somebody help me with an advice on how to create an vault in AWX. I am trying to have the vcenter login data encrypted as string variable in a vault but don’t know how.  
Thanks.

---

<div class="post-metadata">

**Author:** ![sdmorel](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sdmorel](https://forum.ansible.com/u/sdmorel)\
**Post date:** [June 28, 2019, 7:29am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680/2 "2019-06-28T07:29:39Z")

</div>

Hello,

Why don’t you use the VMWare vCenter credential type in AWX?  
[https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#vmware-vcenter](https://docs.ansible.com/ansible-tower/latest/html/userguide/credentials.html#vmware-vcenter)

You can access the credentials from the environment variables like VMWARE\_HOST, VMWARE\_USER, etc.

---

<div class="post-metadata">

**Author:** ![Daniel\_Nanboe](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Daniel\_Nanboe](https://forum.ansible.com/u/Daniel_Nanboe)\
**Post date:** [June 28, 2019, 8:49am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680/3 "2019-06-28T08:49:54Z")

</div>

Yes I did tried that but is not working. I am adding the credentials to the template (the credentials are ok because I can sync the inventory using them) but when running the playbook I get the error bellow. Is like the credentials are not there.

fatal: [localhost]: FAILED! =\> {“msg”: “The task includes an option with an undefined variable. The error was: ‘VMWARE\_USER’ is undefined\n\nThe error appears to be in ‘/var/lib/awx/projects/oracle-vm/create-vm-oracle-11g.yml’: line 8, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Clone VM from template\n ^ here\n”}

 ![by default 2019-06-28 at 11.49.15.png](https://us1.discourse-cdn.com/ansible/original/2X/a/a6ead96ff2e1269f434693c8255507092c65da91.png)

---

<div class="post-metadata">

**Author:** ![sdmorel](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sdmorel](https://forum.ansible.com/u/sdmorel)\
**Post date:** [June 28, 2019, 8:58am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680/4 "2019-06-28T08:58:41Z")

</div>

Hi,

The credentials are exposed as environment variables, not Ansible variable.

You need to use something like “{{ lookup(‘env’, ‘VMWARE\_HOST’) }}” to access them.

Regards,

---

<div class="post-metadata">

**Author:** ![Daniel\_Nanboe](https://avatars.discourse-cdn.com/v4/letter/d/9d8465/32.png) [@Daniel\_Nanboe](https://forum.ansible.com/u/Daniel_Nanboe)\
**Post date:** [June 29, 2019, 5:54am UTC](https://forum.ansible.com/t/create-an-vault-in-awx-5-0-multi-environment/30680/5 "2019-06-29T05:54:23Z")

</div>

Thanks Sergio,

It is working I found later also an example in the documentation but it was not on the authentification page but on the template:

[https://docs.ansible.com/ansible-tower/latest/html/userguide/job\_templates.html#id6](https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#id6)

But I am also curios how to use the Vault credential type. I am not able to find an example in the documentation.

Thanks.  
daniel
