Let me make sure I get this all straight with detail. I’m so close to figuring this out, but I have hit a roadblock. I’m simply trying to automate any process at this point within VMware by way of AWX.
I have installed the following:
pip install pyvmomi
ansible-galaxy collection install community.vmware
Running AWX 23.6.0
My “inventory” for hosts is sourced from GitHub, and that sync works fine, pointing to /(project root).
Within my “project root” directory on GitHub, I have the following files:
inventory.ini:
[vcsa]
10.0.0.3
[esxi]
10.0.0.0
10.0.0.1
ansible.cfg:
[inventory]
enable_plugins = community.vmware.vmware_vm_inventory
vmware_vm_inventory.vmware.yml:
plugin: community.vmware.vmware_vm_inventory
strict: False
hostname: 10.0.0.3
username: <removed username here>
validate_certs: False
with_tags: False
with_folders: True
Now, within AWX, my Inventory and Projects items sync just fine.
I’m running AWX on Fedora, but I wouldn’t think that would be a big concern. If I perform a Dynamic Inventory for VCSA, it works fine.
For the life of me, I can’t get any playbooks to run without the inventory file being parsed.
Here is the playbook:
---
- name: Add a distributed switch to vCenter datacenter
hosts: localhost
gather_facts: no
tasks:
- name: Add distributed switch
community.vmware.vmware_dvs_host:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
esxi_hostname: "{{ esxi_hostname }}"
switch_name: "{{ switch_name }}"
datacenter_name: "HOME-1"
state: present
I feel like I’m 99% there on getting this to work. If not, I will just go back to using Python and PowerCLI, which I have no problem getting to work, but I really want to get AWX working.