community.vmware.vmware_host_facts - vcenter username/pass

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

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).

Thank you!