Initial code for deploying K3s binary (throttled)
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Danny Bessems 2022-04-19 16:36:19 +02:00
parent 485ba68ebb
commit 50b0f52744
2 changed files with 25 additions and 5 deletions

View File

@ -1,4 +1,5 @@
- hosts: localhost - name: Provision VM's
hosts: localhost
gather_facts: false gather_facts: false
vars_files: vars_files:
- hypervisor.vcenter.yml - hypervisor.vcenter.yml
@ -19,7 +20,7 @@
datacenter: "{{ hv.datacenter }}" datacenter: "{{ hv.datacenter }}"
folder: "{{ hv.folder }}" folder: "{{ hv.folder }}"
cluster: "{{ hv.cluster }}" cluster: "{{ hv.cluster }}"
name: "{{ kubernetes.clustername | upper }}-{{ (item.ip | checksum)[-5:] | upper }}" name: "{{ cluster.name | upper }}-{{ (item.ip | checksum)[-5:] | upper }}"
datastore: "{{ hv.datastore }}" datastore: "{{ hv.datastore }}"
disk_provisioning: thin disk_provisioning: thin
networks: networks:
@ -28,7 +29,7 @@
ovf: /scratch/image.ova ovf: /scratch/image.ova
deployment_option: "{{ image.deployment_option }}" deployment_option: "{{ image.deployment_option }}"
properties: properties:
guestinfo.hostname: "{{ kubernetes.clustername | upper }}-{{ (item.ip | checksum)[-5:] | upper }}" guestinfo.hostname: "{{ cluster.name | upper }}-{{ (item.ip | checksum)[-5:] | upper }}"
guestinfo.rootpw: "{{ root_password }}" guestinfo.rootpw: "{{ root_password }}"
guestinfo.rootsshkey: "foo" guestinfo.rootsshkey: "foo"
guestinfo.ntpserver: "{{ network.ntpserver }}" guestinfo.ntpserver: "{{ network.ntpserver }}"
@ -63,3 +64,21 @@
ansible_host: "{{ item.ip }}" ansible_host: "{{ item.ip }}"
groups: k3s_ha groups: k3s_ha
with_items: "{{ nodes }}" with_items: "{{ nodes }}"
- name: Provision Kubernetes
hosts: k3s_ha
gather_facts: false
# vars_files:
# - hypervisor.vcenter.yml
# - cluster.k3s.yml
tasks:
- name: Iterate over hosts
block:
- name: Install K3s binary
ansible.builtin.command:
cmd: "curl -sfL https://get.k3s.io | sh -s - server --cluster-init --disable local-storage,traefik --tls-san {{ cluster.virtualip | ansible.utils.ipaddr('address') }}"
environment:
K3S_TOKEN: env.k3s_token | default('', true)
K3S_URL: env.k3s_url | default('', true)
throttle: 1

View File

@ -1,6 +1,7 @@
--- ---
kubernetes: cluster:
clustername: k3s-dev name: k3s-dev
virtualip: 192.168.11.120/24
image: image:
deployment_option: large deployment_option: large
ova_url: sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova ova_url: sn.itch.fyi/Repository/rel/Ubuntu-Server-20.04.ova