ansible-vmware-http icon indicating copy to clipboard operation
ansible-vmware-http copied to clipboard

Examples of Ansible playbook to manage VMware using HTTP APIs

Ansible VMware Sample Playbooks for handling HTTP APIs

Following repos show how Ansible can be utilized to consume VMware HTTP APIs.

Requirements

VMware HTTP APIs are supported in vCenter 6.5 and onwards. So, in order to use these playbooks you need to have vCenter version greater than equal to 6.5.

If you are going to use Pyvmomi based (XMLRPC based) modules then you need to install Pyvmomi using pip install pyvmomi.

Examples

Example Ansible playbook to manage VMware using HTTP APIs:

  • Get a list of all Datacenters available
  • Get a list of all Clusters available
  • Get a list of all ESXi hosts available
  • Get a list of all Datastores available
  • Get a list of all Network available
  • Get a list of all Virtual machine available
  • Get a list of all categories available
  • Get a list of all tags available
  • Get information about the given Cluster
  • Get a list of tags attached to the given virtual machine

Caveats

Currently, these APIs are under development so not all features are available in vCenter server as a part of API.

Links

Ansible VMware Documentation

vBrownBag videos link