This commit is contained in:
NAGY Akos
2023-12-13 19:21:40 +02:00
commit 6ae461b7ef
12 changed files with 590 additions and 0 deletions

30
tasks/02create_first.yaml Normal file
View File

@@ -0,0 +1,30 @@
---
- name: Create virtual machines from template
community.vmware.vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: false
folder: "/{{ datacenter }}/vm/{{ vm_parent_folder_name }}/{{ vm_folder_name }}"
datacenter: "{{ datacenter }}"
cluster: "{{ cluster }}"
datastore: "{{ datastore }}"
resource_pool: "{{ resource_pool }}"
name: "test-{{ item.value.hostname }}"
template: "{{ vm_hostname_template }}"
state: poweredon
disk:
- size: 100gb
advanced_settings:
- key: "guestinfo.ignition.config.data"
value: "{{ lookup('template', 'ignition/{{ item.value.hostname }}.json') | b64encode }}"
- key: "guestinfo.ignition.config.data.encoding"
value: "base64"
wait_for_ip_address: true
wait_for_ip_address_timeout: 600
with_dict: "{{ kubehosts }}"
register: deploy_vm
# - name: Show debug info
# debug:
# msg: "{{ deploy_vm.results.instance.ipv4 }}"