How-to For: developers

Ansible

Use the community.vmware, vmware.vmware and vmware.vmware_rest collections with the controller, the modules that were verified and the known gaps.

The Ansible collections for VMware connect to the SOAP endpoint (community.vmware, vmware.vmware) and to the REST endpoint (vmware.vmware_rest) of the controller. The recorded verification used ansible-core 2.22.0 with community.vmware 7.0.0, vmware.vmware 2.13.0 and vmware.vmware_rest 5.0.0.

Before you start

  • Turn the compatibility endpoints on: Settings of the compatibility endpoints.
  • Use the account of a Kyvernon user. The modules use the privileges of the account like any other client.
  • The controller uses a certificate that the modules do not know by default: set validate_certs: false for a test, or trust the certificate on the control machine.

With the CLI

Set the connection once for all modules of the collection, then run tasks as for vSphere:

YAML
- name: Inventory of Kyvernon
  hosts: localhost
  gather_facts: false
  module_defaults:
    group/community.vmware.vmware:
      hostname: "controller.example.com:8443"
      username: "{{ kyvernon_user }}"
      password: "{{ kyvernon_password }}"
      validate_certs: false
  tasks:
    - name: List the virtual machines
      community.vmware.vmware_vm_info:
      register: vms
    - name: Create a virtual machine
      community.vmware.vmware_guest:
        name: prod-web-01
        datacenter: Datacenter
        folder: /Datacenter/vm
        datastore: ds-local-01
        guest_id: otherLinux64Guest
        hardware:
          num_cpus: 2
          memory_mb: 2048
        disk:
          - size_gb: 20
            type: thin
            datastore: ds-local-01
        networks:
          - name: vm-net-01
        state: present

Keep the password in an encrypted variable file of Ansible Vault.

Verified modules

CollectionModules
community.vmwarevmware_about_info, vmware_datacenter_info, vmware_host_facts, vmware_datastore_info, vmware_vswitch_info, vmware_portgroup_info, vmware_resource_pool_info, vmware_folder_info, vmware_vm_info, vmware_local_role_info, vmware_guest (create, reconfigure, clone, destroy), vmware_guest_info, vmware_guest_disk, vmware_guest_disk_info, vmware_guest_network, vmware_guest_snapshot (create, revert, remove all), vmware_guest_snapshot_info
vmware.vmwarecluster_info, folder, vm_powerstate
vmware.vmware_restvcenter_datacenter_info, vcenter_host_info, vcenter_datastore_info, vcenter_network_info, vcenter_folder_info, vcenter_resourcepool_info, vcenter_storage_policies_info, content_library_info, vcenter_vm_info, vcenter_vm_hardware_info, the hardware information modules for disks, adapters, CD-ROMs, SCSI adapters and boot, vcenter_vm_hardware_boot, vcenter_vm_hardware_serial, vcenter_vm_tools_info, vcenter_vm_power_info, vcenter_vm_guest_identity_info, vcenter_vm_guest_power_info

The complete list with the result of each is in verified tools.

Known gaps

  • The tag and category modules of community.vmware (vmware_category, vmware_tag, vmware_tag_info) failed in the recorded run, because the Python library of the vSphere Automation SDK that they need was not installed in the test environment. They are not verified.
  • A virtual machine without a running guest agent reports no guest identity and no guest power state. The modules that read them return the corresponding error, which is the expected answer.
  • The vmware_rest module for the appliance version reports an error, because the controller is not a vCenter appliance.

Version 0.1. Last changed: 2026-11-13