# community.vmware.vmware\_host\_facts - vcenter username/pass

**URL:** <https://forum.ansible.com/t/community-vmware-vmware-host-facts-vcenter-username-pass/37766>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [March 14, 2023, 5:26pm UTC](https://forum.ansible.com/t/community-vmware-vmware-host-facts-vcenter-username-pass/37766 "2023-03-14T17:26:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [March 14, 2023, 5:26pm UTC](https://forum.ansible.com/t/community-vmware-vmware-host-facts-vcenter-username-pass/37766/1 "2023-03-14T17:26:15Z")

</div>

can i get help on how to put my vcenter credentials

vcenter\_username  
vcenter\_password

into a vault file and then run playbook using vault file. I dont want to put the info into the pb

thanks

---

<div class="post-metadata">

**Author:** ![Will\_McDonald](https://avatars.discourse-cdn.com/v4/letter/w/f475e1/32.png) [@Will\_McDonald](https://forum.ansible.com/u/Will_McDonald)\
**Post date:** [March 14, 2023, 6:15pm UTC](https://forum.ansible.com/t/community-vmware-vmware-host-facts-vcenter-username-pass/37766/2 "2023-03-14T18:15:17Z")

</div>

[https://www.digitalocean.com/community/tutorials/how-to-use-vault-to-protect-sensitive-ansible-data](https://www.digitalocean.com/community/tutorials/how-to-use-vault-to-protect-sensitive-ansible-data) walks you through the basics with some good practices.

For example:

$ mkdir -p ./inventories/group\_vars/all/{vars,vault}

$ ansible-vault create ./inventories/group\_vars/all/vault/all.yml

$ ansible-vault edit ./inventories/group\_vars/all/vault/all.yml

vaulted\_vcenter\_username:   
vaulted\_vcenter\_password:

$ vim ./inventories/group\_vars/all/vars/all.yml  
vcenter\_username: “{{ vaulted\_vcenter\_username }}”

vcenter\_password: “{{ vaulted\_vcenter\_password }}”

Then use vcenter\_username & vcenter\_password in your roles or plays (with a .vault\_pass or --ask-vault-pass as required).

---

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [March 14, 2023, 8:07pm UTC](https://forum.ansible.com/t/community-vmware-vmware-host-facts-vcenter-username-pass/37766/3 "2023-03-14T20:07:17Z")

</div>

Thank you!
