The vmware_guest module

This module allows you to launch and manage virtual machines within your VMware cluster; the following example shows how you would launch a VM using a template:

- name: Create a VM from a template  vmware_guest:    hostname: "{{ vsphere_host }}"    username: "{{ vsphere_username }}"    password: "{{ vsphere_password }}"    validate_certs: "no"    datacenter: "my-datacenter"    folder: "/vms"    name: "yet_another_example_vm"    state: "poweredon"    template: "centos7-x86_64-1804"    disk:      - size_gb: "40"        type: "thin"        datastore: "my_datastore"    hardware:      memory_mb: "4048"      num_cpus: "4"      max_connections: "3"      hotadd_cpu: "True"      hotremove_cpu: "True"      hotadd_memory: "True"    networks:      - name: "VM Network"        ip: "192.168.1.100"        netmask: "255.255.255.0" gateway: ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.