Search code examples
ansiblevsphere

Can I manage guest VMs in vSphere free using Ansible without vCenter?


Seems to me that most of the existing Ansible modules require vCenter. For example guest_module has required parameter vcenter_hostname. The question is - is there an ability to manage 2-3 vSphere hosts using Ansible? I need creating virtual environments(virtual networks, guest VMs, load balancing endpoints).

I also considered Hyper-v but it doesn't have Ansible modules. Direct powershell management considered as a last resort for Hyper-v.


Solution

  • Yes, you can do things that are allowed by free license.

    There's a hint in the docs:

    For standalone ESXi hosts, ha-datacenter should be used as the datacenter name

    I use vsphere_guest without any problems with standalone hypervisors with the following parameters filled in:

    - vsphere_guest:
        vcenter_hostname: "{{ esxi_ip_or_dns }}" # ip address of hypervisor
        esxi:
          datacenter: ha-datacenter
          hostname: "{{ esxi_hostname }}" # name shown in hypervisor console
        username: "{{ esxi_username }}"
        password: "{{ esxi_password }}"
    

    But keep in mind, that many useful features are blocked in free license. For example, you can't clone VMs without vCenter license.