AWX Credential usage general and VMware VCenter credential type

I cannot find information on how to use AWX credentials. Specifically I would like to use the VMware Vcenter credential to authenticate to Vcenter. I am unable to access the vsphere hostname, username or password in my playbooks.
I cannot find any documentation on AWX credentials other than how to create them. Is there documentation on how to use them in playbooks by reference variables?

The way AWX does credentials is a bit difficult to wrap one’s head around when you’re first getting started, at least it was for me. So I feel your pain.

AWX comes with several credential types out of the box, and one of them is the “VMware vCenter” credential. Create a new credential by logging in to the UI, and under Resources, click Credentials then add. Select “VMware vCenter” as the type and fill out the info.

Looking at how the cred works, it looks like it creates environment variables instead of extra_vars. Kinda odd, but they appear to be environment variables named VMWARE_USER, VMWARE_PASSWORD, and VMWARE_HOST. You can set these values via ansible.builtin.env lookup – Read the value of environment variables — Ansible Community Documentation

Some caveats:

You can only have one credential type associated with a template. Meaning, all your templates using this new “VMware vCenter” credential can only ever have one “VMware vCenter” tied to it at a time (they can have any other credential type tied to it simultaneously, such as Machine, but the rule of only one of those categories of credential type applies as well). So whoever is launching your job may need to pick the correct credential on launch (this is a configurable option on the job template level, “Prompt on launch”).

You may also want to consider using a centralized secrets store like Hashicorp vault, or Azure Key Vault, or the AWS one or whatever since utilizing those gets around some of the stickier problems of using credentials in AWX. That’s kinda like a “day 2 ops” type of thing, I suppose. Or maybe what I wrote above is good enough for your use-case and you don’t need a dedicated secrets store.

At any rate, I hope this is helpful!

Thank you very much! That is very helpful!