2022-04-18 10:58:57 +00:00
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: false
|
|
|
|
vars_files:
|
2022-04-18 12:28:05 +00:00
|
|
|
- hypervisor.vcenter.yml
|
2022-04-18 19:35:28 +00:00
|
|
|
- cluster.k3s.yml
|
2022-04-18 10:58:57 +00:00
|
|
|
tasks:
|
|
|
|
- name: Clone multiple VMs from template
|
2022-04-18 12:28:05 +00:00
|
|
|
community.vmware.vmware_guest:
|
|
|
|
hostname: "{{ hv.hostname }}"
|
|
|
|
username: "{{ hv.username }}"
|
|
|
|
password: "{{ hv_password }}"
|
2022-04-18 10:58:57 +00:00
|
|
|
validate_certs: no
|
2022-04-18 12:28:05 +00:00
|
|
|
datacenter: "{{ hv.datacenter }}"
|
|
|
|
folder: "{{ hv.folder }}"
|
|
|
|
cluster: "{{ hv.cluster }}"
|
2022-04-18 20:33:11 +00:00
|
|
|
name: "{{ kubernetes.clustername | upper }}_{{ (item.ip | checksum | regex_replace('[0-9]', ''))[-5:] | upper }}"
|
2022-04-18 13:56:31 +00:00
|
|
|
guest_id: "{{ item.guest_id }}"
|
2022-04-18 14:26:57 +00:00
|
|
|
hardware:
|
|
|
|
memory_mb: 8192
|
|
|
|
num_cpus: 4
|
2022-04-18 13:53:21 +00:00
|
|
|
disk:
|
|
|
|
- size_gb: 50
|
|
|
|
type: thin
|
|
|
|
datastore: "{{ hv.datastore }}"
|
2022-04-18 17:45:41 +00:00
|
|
|
networks:
|
|
|
|
- name: "{{ hv.network }}"
|
2022-04-18 20:26:52 +00:00
|
|
|
ip: "{{ item.ip | ansible.utils.ipaddr('address') }}"
|
|
|
|
netmask: "{{ item.ip | ansible.utils.ipaddr('netmask') }}"
|
2022-04-18 13:47:06 +00:00
|
|
|
cdrom:
|
2022-04-18 17:45:41 +00:00
|
|
|
- type: iso
|
2022-04-18 13:47:06 +00:00
|
|
|
iso_path: "[{{ hv.isodatastore }}] {{ item.iso_path }}"
|
2022-04-18 20:26:52 +00:00
|
|
|
controller_number: 0
|
|
|
|
unit_number: 0
|
2022-04-18 10:58:57 +00:00
|
|
|
state: poweredon
|
2022-04-18 12:28:05 +00:00
|
|
|
# customization_spec: "{{ customization_spec }}"
|
|
|
|
delegate_to: localhost
|
2022-04-18 10:58:57 +00:00
|
|
|
with_items: "{{ servers }}"
|