2024-06-12 02:28:58 +00:00
|
|
|
- hosts: localhost
|
|
|
|
vars_files:
|
|
|
|
- vars/ova.bootstrap.yaml
|
|
|
|
- vars/hv.vcenter.yaml
|
|
|
|
- vars/pb.secrets.yaml
|
|
|
|
tasks:
|
|
|
|
|
2024-06-14 02:32:06 +00:00
|
|
|
- name: Retrieve target folder details
|
|
|
|
community.vmware.vmware_vm_info:
|
|
|
|
hostname: "{{ hv.hostname }}"
|
|
|
|
username: "{{ hv.username }}"
|
|
|
|
password: "{{ secrets.hv.password }}"
|
|
|
|
folder: "{{ hv.folder }}"
|
|
|
|
validate_certs: false
|
|
|
|
register: vm_info
|
|
|
|
|
|
|
|
- name: User prompt
|
|
|
|
ansible.builtin.pause:
|
|
|
|
prompt: Virtual machine '{{ appliance.id }}' already exists. Delete to continue [yes] or abort [no]?"
|
|
|
|
register: prompt
|
|
|
|
until:
|
|
|
|
- prompt.user_input in ['yes', 'no']
|
|
|
|
delay: 0
|
|
|
|
when: (vm_info | selectattr('guest_name', 'equalto', appliance.id) | length) > 0
|
|
|
|
|
|
|
|
- name: Destroy existing VM
|
|
|
|
community.vmware.vmware_guest:
|
|
|
|
hostname: "{{ hv.hostname }}"
|
|
|
|
username: "{{ hv.username }}"
|
|
|
|
password: "{{ secrets.hv.password }}"
|
|
|
|
folder: "{{ hv.folder }}"
|
|
|
|
name: appliance.id
|
|
|
|
state: absent
|
|
|
|
when:
|
|
|
|
- (vm_info | selectattr('guest_name', 'equalto', appliance.id) | length) > 0
|
|
|
|
- (prompt.user_input | bool) == true
|
|
|
|
|
2024-06-12 02:28:58 +00:00
|
|
|
- name: Deploy VM from OVA-template
|
|
|
|
community.vmware.vmware_deploy_ovf:
|
|
|
|
hostname: "{{ hv.hostname }}"
|
|
|
|
username: "{{ hv.username }}"
|
|
|
|
password: "{{ secrets.hv.password }}"
|
2024-06-14 02:32:06 +00:00
|
|
|
validate_certs: false
|
2024-06-12 02:28:58 +00:00
|
|
|
datacenter: "{{ hv.datacenter }}"
|
|
|
|
folder: "{{ hv.folder }}"
|
|
|
|
cluster: "{{ hv.cluster }}"
|
|
|
|
name: airgapped-k8s-meta1
|
|
|
|
datastore: "{{ hv.datastore }}"
|
|
|
|
disk_provisioning: thin
|
|
|
|
networks:
|
|
|
|
"LAN": "{{ hv.network }}"
|
|
|
|
power_on: yes
|
|
|
|
ovf: "{{ appliance.path }}/{{ appliance.filename }}"
|
|
|
|
deployment_option: cp1w1ws0
|
|
|
|
properties:
|
|
|
|
metacluster.fqdn: k8s.lab
|
|
|
|
metacluster.vip: 192.168.154.125
|
|
|
|
metacluster.token: "{{ secrets.appliance.installtoken }}"
|
|
|
|
# guestinfo.hostname: _default
|
|
|
|
metacluster.password: "{{ secrets.appliance.password }}"
|
|
|
|
guestinfo.ipaddress: 192.168.154.126
|
|
|
|
guestinfo.prefixlength: '24'
|
|
|
|
guestinfo.dnsserver: 192.168.154.225
|
|
|
|
guestinfo.gateway: 192.168.154.1
|
|
|
|
# workloadcluster.name: _default
|
|
|
|
workloadcluster.vip: 192.168.154.130
|
|
|
|
ippool.startip: 192.168.154.135
|
|
|
|
ippool.endip: 192.168.154.140
|
|
|
|
workloadcluster.nodetemplate: ubuntu-2204-kube-v1.30.0
|
|
|
|
workloadcluster.nodesize: small
|
|
|
|
# workloadcluster.additionaldisk: '75'
|
|
|
|
guestinfo.rootsshkey: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAiRc7Og+cRJGFwdUzgpX9YqvVenTk54N4kqM7emEfYHdsJLMjKQyxr8hklHmsam5dzxx3itFzc6SLf/ldJJ2JZuzE5FiCqUXXv4UFwN6HF5xqn7PTLicvWZH93H4m1gOlD5Dfzi4Es34v5zRBwbMScOgekk/LweTgl35jGKDgMP5DjGTqkPf7Ndh9+iuQrz99JEr8egl3bj+jIlKjScfaQbbnu3AJIRwZwTKgw0AOkLliQdEPNLvG5/ZImxJG4oHV9/uNkfdJObLjT1plR1HbVNskV5fuRNE/vnUiWl9jAJ1RT83GOqV0sQ+Q7p214fkgqb3JPvci/s0Bb7RA85hBEQ== bessems.eu
|
|
|
|
hv.fqdn: "{{ hv.hostname }}"
|
|
|
|
hv.username: "{{ hv.username }}"
|
|
|
|
hv.password: "{{ secrets.hv.password }}"
|
|
|
|
ldap.fqdn: _unused
|
|
|
|
ldap.dn: _unused
|
|
|
|
ldap.password: _unused
|