56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
---
|
|
# Playbook for deploying a Kubernetes cluster on QEMU
|
|
- name: Prepare virtualization environment
|
|
hosts: alpha-worker-0
|
|
become: true
|
|
tasks:
|
|
- name: Install QEMU
|
|
apt:
|
|
state: present
|
|
name:
|
|
- qemu-system
|
|
- libvirt-daemon-system
|
|
- name: Create network bridge for cluster
|
|
- name: Create control plane
|
|
- name: Create workers
|
|
- name: Start cluster
|
|
|
|
- name: Initialize cluster nodes
|
|
hosts: clusters
|
|
become: true
|
|
roles:
|
|
- role: ericomeehan.debian
|
|
- role: ericomeehan.ericomeehan
|
|
|
|
- name: Install Kubernetes on cluster nodes
|
|
hosts: #TODO: get cluster nodes dynamically
|
|
become: true
|
|
pre_tasks:
|
|
- name: Update sysctl configuration to enable IPv4 packet forwarding
|
|
lineinfile:
|
|
path: /etc/sysctl.conf
|
|
line: 'net.ipv4.ip_forward = 1'
|
|
state: present
|
|
- name: Update sysctl configuration to enable IPv6 packet forwarding
|
|
lineinfile:
|
|
path: /etc/sysctl.conf
|
|
line: 'net.ipv6.conf.all.forwarding = 1'
|
|
state: present
|
|
- name: Reload sysctl configuration
|
|
command: sysctl --system
|
|
- name: Enable br_netfilter kernel module
|
|
command: modprobe br_netfilter
|
|
- name: Add the module to a configuration file for persistence
|
|
lineinfile:
|
|
path: /etc/modules-load.d/modules.conf
|
|
line: "br_netfilter"
|
|
- name: Install kubernetes library
|
|
apt:
|
|
name: python3-kubernetes
|
|
state: present
|
|
roles:
|
|
- role: geerlingguy.containerd
|
|
- role: geerlingguy.kubernetes
|
|
- role: geerlingguy.helm
|
|
when: kubernetes_role == 'control_plane'
|