I’m trying to create dynamic inventories to manage ESX Hosts & VMs. I’ve created a custom execution environment to use the vmware.vmware collection plugins. Even though I declared the plugin in the source variables when syncing the inventory, AWX parses it with the auto plugin. It gathered only VMs information although tried with plugin: vmware.vmware.esxi_hosts.
process inventory source ‘/runner/inventory/vmware_vm_inventory.yml’, I thought the file name might be causing that issue.
Does your inventory YAML file contain plugin: vmware.vmware.vms?
While this is shown in the examples of the vmware.vmware.vms inventory plugin, its “Parameters” documentation unfortunately does not mention it. This field should be set for every plugin to the plugin’s FQCN, and is used by the auto plugin to determine which plugin to use (this is mentioned in the ansible.builtin.auto plugin’s docs).
Other inventory plugins explicity mention this as a required parameter for this reason, for example:
I tried again on cli with required inventory file name, there is nothing wrong about execution environment or collection dependencies. Worked fine with simple config.
The problem occures when it’s come to create dynamic AWX inventory. I created an inventory and added vCenter source. Then I added plugin as source variable but it ignores when syncing inventory. As I mentioned before it uses “vmware_vm_inventory” with auto plugin, so I didn’t define or altered the “.yml” file name, it’s automatically created as “/runner/inventory/vmware_vm_inventory.yml”
If I could use the plugin that I declared from the GUI, it would have been much easier, but I will review other options. Thanks for your kind support. I created dynamic ESX host inventory using awx.awx.inventory and community.vmware plugins before, but it’s not handy.
I tested all vmware inventory in production all is Ok with the last version of plugins and awx.
As mentionned before, if you use :
plugin: vmware.vmware.vms
You need to have a inventory file end with vms.yml, vms.yaml, vmware_vms.yml, or vmware_vms.yaml for vm :source (plugins have some verify function)
and esxi_hosts.yml, esxi_hosts.yaml, vmware_esxi_hosts.yml, or vmware_esxi_hosts.yaml for esxi source
Do not forget in you awx to specify a EE with the plugins installed.
I think you should do like this :
Create a VMware vCenter credential type (native awx) (Specify vcenter hostname)
Create a inventory file in a project with the name : esxi_hosts.yaml containing :
If your project is on git, do not forget to update your project on awx.
Create a empty inventory
Add a source to your inventory
Select sources : From project
Specidy your EE with vmware.vmware plugin and your cred.
Specify you path to inventory file (AWX do not list YML file for inventory … so you need to be sure)
Save and Sync !
For VMS inventory you got 2 opiotns : Same as ESXI Host or AWX native with Source Type : VMware Vcenter, select your cred created before and “voila” !
You can filter from source variable, redhat do a nice tutorial here
If you got trouble, ping me, i will screen my config