Setup AWX Vcenter inventory with tags part 2

This is the second part in how you can setup Vmware inventory in AWX based on VM tags. Link to first part.

Create a file that ends with vmware.yml or vmware.yaml. For example invent. I called my file invent.vmware.yml

plugin: vmware_vm_inventory
strict: False
validate_certs: False
with_tags: True
  - ''
  ansible_host: 'guest.hostName'
  - key: 'tags'
    separator: ''

Make sure to set you hostname and check in your file in a Git repository.

Create a project, my is called Inventory an select Git as SCCM Type. Add you Git repository URL as SCM URL. Don´t forget to create SCM credentials if you haven’t done that already. Set /opt/my-envs/vm-tags as Ansible environment.

Next step is to create a custom credential type. I called my Vmware_Inventory

#Input configuration
  - id: username
    type: string
    label: Username
  - id: password
    type: string
    label: Password
    secret: true
  - username
  - password

#Injector configuration
  VMWARE_PASSWORD: '{{password}}'
  VMWARE_USERNAME: '{{username}}'

Create a new credential with your new credential type. You will need a user with read permissions in your Vcenter server.

Go to Inventory and create a new Inventory and give a name and hit Save.

Click sources and create a new source. Give it a name and select Sourced from a project as a sources. Set /opt/my-ens/vm-tags/ as ansible environment. Search for and select for your credential with read permission in Vcenter.

Now you should be able to sync your new inventory.

After the sync has finished you should see your hosts and groups.

For example I have connection details as a group variable on my group win. All my windows server are in the group win. I needed you cand have second group like SQL servers and then add that group to win group to allow it to inherit all win group variables.

ansible_winrm_server_cert_validation: ignore
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: kerberos

That’s it, hopefully this can be helpful to any one seeking information about AWX and Vmware tags as inventory groups.

5 thoughts on “Setup AWX Vcenter inventory with tags part 2

  1. Hello,
    thank you for your doc, but i’m trying to follow step by step what you did but without success.
    can give me step by step the configuration.
    or put the file vmware.yml or vmware.yaml
    I added the Custom virtual environment paths in system, but no new ansibe environment in sight in the organization.
    can help me please.


    • how far have you come? Have you completed part 1 and can see your custom variable? vmawre.yml is the file at the top section called invent.vmware.yml in my example.


  2. hello I am French, I found a solution based on your example. I do that:
    docker exec -ti awx_task bash

    source / var / lib / awx / venv / ansible / bin / activate
    yum install gcc
    yum install python36-devel
    pip3 install –upgrade pip
    pip3 install –upgrade azure-cli-core
    pip3 install –upgrade wheel
    pip3 install psutil
    pip3 install ansible
    pip3 install pyaml
    pip3 install requests
    pip3 install PyVmomi
    pip3 install –upgrade pip setuptools
    pip3 install –upgrade git + https: //


    then I connect to AWX in http and create an inventory with your variables:

    plugin: vmware_vm_inventory
    strict: False
    validate_certs: False
    with_tags: True
    – ‘’
    ansible_host: ‘guest.hostName’
    – key: ‘tags’
    separator: ”
    however would it be possible to help me in the selections of hosts to show, for example:
    do not display templates
    do not display turned off VMs
    display VMs according to OS
    display VMs according to tags
    display VMs according to custum

    please, thank you and again thank you for your doc, we must continue to propose topics.
    what about you, where do you come from?


  3. cool that the world is small, i know the saint-gobin company, i work for the ministry of defense and i need to set up a private cloud. the problem is that i don’t know the CICD part and have a hard time launching playbooks only on vms with a well-defined tag. I thank you for your help a +.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.