Ansible.K3sCluster/playbook.yml

40 lines
1.5 KiB
YAML
Raw Normal View History

2022-04-18 10:58:57 +00:00
- hosts: localhost
gather_facts: false
vars_files:
- hypervisor.vcenter.yml
- cluster.k3s.yml
2022-04-18 10:58:57 +00:00
tasks:
- name: Download OVF-template
ansible.builtin.get_url:
url: "https://{{ repo_username }}:{{ repo_password }}@{{ image.ova_url }}"
dest: /scratch/image.ova
- name: Deploy VMs from OVF-template
community.vmware.vmware_deploy_ovf:
hostname: "{{ hv.hostname }}"
username: "{{ hv.username }}"
password: "{{ hv_password }}"
2022-04-18 10:58:57 +00:00
validate_certs: no
datacenter: "{{ hv.datacenter }}"
folder: "{{ hv.folder }}"
cluster: "{{ hv.cluster }}"
name: "{{ kubernetes.clustername | upper }}-{{ (item.ip | checksum)[-5:] | upper }}"
datastore: "{{ hv.datastore }}"
2022-04-18 21:08:48 +00:00
disk_provisioning: thin
networks:
"LAN": "{{ hv.network }}"
power_on: yes
ovf: /scratch/image.ova
2022-04-18 21:08:48 +00:00
deployment_option: "{{ image.deployment_option }}"
properties:
guestinfo.hostname: "{{ kubernetes.clustername | upper }}-{{ (item.ip | checksum)[-5:] | upper }}"
2022-04-18 21:08:48 +00:00
guestinfo.rootpw: "{{ root_password }}"
guestinfo.rootsshkey: "foo"
guestinfo.ntpserver: "{{ network.ntpserver }}"
2022-04-18 21:12:30 +00:00
guestinfo.ipaddress: "{{ item.ip | ansible.utils.ipaddr('address') }}"
guestinfo.prefixlength: "{{ (item.ip | ansible.utils.ipaddr('prefix') }}"
guestinfo.dnsserver: "{{ network.dnsserver }}"
guestinfo.gateway: "{{ network.gateway }}"
# customization_spec: "{{ customization_spec }}"
delegate_to: localhost
2022-04-18 10:58:57 +00:00
with_items: "{{ servers }}"