feat(networking): install and configure wireguard encryption

by default set to false.

!2 #3
This commit is contained in:
2023-10-29 16:53:00 +09:30
parent 57d268ec3c
commit 60fd25df8e
3 changed files with 38 additions and 0 deletions

View File

@ -17,3 +17,14 @@
install_kubernetes | default(true) | bool
and
not kubernetes_installed | default(false) | bool
- name: Wireguard Cluster Encryption
ansible.builtin.include_tasks:
file: k3s/configure.yaml
when: >
install_kubernetes | default(true) | bool
and
not kubernetes_installed | default(false) | bool
and
not kubernetes_installed_encryption | default(false) | bool

26
tasks/k3s/wireguard.yaml Normal file
View File

@ -0,0 +1,26 @@
---
- name: Install Wireguard
ansible.builtin.apt:
name:
- wireguard
update_cache: false
when: >
ansible_os_family == 'Debian'
and
kubernetes.networking.encrypt | default(false) | bool
- name: Enable Cluster Encryption
ansible.builtin.command:
cmd: kubectl patch felixconfiguration default --type='merge' -p '{"spec":{"wireguardEnabled":true,"wireguardEnabledV6":true}}'
changed_when: false
when: >
ansible_os_family == 'Debian'
and
kubernetes.networking.encrypt | default(false) | bool
and
kubernetes_config.cluster.prime.name == inventory_hostname
- name: Set Kubernetes Encryption Final Install Fact
ansible.builtin.set_fact:
kubernetes_installed_encryption: true