Skip to content

Instantly share code, notes, and snippets.

@samueljon
Created September 15, 2021 10:10
Show Gist options
  • Save samueljon/57ac88522658f2c96e32dbf936b1b523 to your computer and use it in GitHub Desktop.
Save samueljon/57ac88522658f2c96e32dbf936b1b523 to your computer and use it in GitHub Desktop.
---
- name: Clone a virtual machine from Linux template
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
resource_pool: ansible-resource-pool
validate_certs: no
datacenter: "{{ datacenter }}"
state: poweredon
folder: "{{ vcenter_folder }}"
template: "{{ template }}"
name: "{{ hostname }}.{{ domainname }}"
cluster: "{{ vcenter_cluster }}"
hardware:
memory_mb: "{{ vm_memory }}"
num_cpus: "{{ vm_cpu_count }}"
hotadd_cpu: True
hotremove_cpu: True
hotadd_memory: True
networks:
- name: "{{ vm_network }}"
ip: "{{ aws_ipaddress }}"
netmask: "{{ vm_netmask }}"
gateway: "{{ vm_gateway }}"
start_connected: True
wait_for_ip_address: True
customization:
hostname: "{{ hostname }}"
domain: "{{ domainname }}"
dns_servers:
- 1.1.1.1
- 1.0.0.1
delegate_to: localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment