23 Commits
Author SHA1 Message Date
Ruakij 1ede3d3329 Read the fail2ban sshd jail from the journal, Debian 12+ has no auth.log and the jail failed to start 2026-10-13 16:36:08 +00:00
Ruakij deb3521bfa Add a proxmox_no_nag role that hides the subscription dialog and reapplies it from an apt hook after every widget-toolkit update 2026-10-13 15:55:56 +00:00
Ruakij c8cac22d12 Run the cilium status check in check mode too and never report it as changed 2026-10-09 14:37:30 +00:00
Ruakij 6fe03c5f70 Skip the cilium CLI download when it is installed already 2026-10-09 14:37:30 +00:00
Ruakij 15b4e54bd5 Read resolv.conf for the k3s nameservers in check mode too 2026-10-09 14:37:30 +00:00
Ruakij c016459922 Write the k3s registries.yaml only on a semantic change 2026-10-09 14:37:29 +00:00
Ruakij 4d1725f17f Deploy a registries.yaml from registries_config on k3s servers and restart k3s on its change 2026-10-09 14:37:29 +00:00
Ruakij 80658c632f Add the cilium network plugin to the kubernetes role, disabling servicelb, and collect the disabled k3s components in one disable list 2026-10-09 14:37:29 +00:00
Ruakij 60b67f748e Install the k3s servers one at a time with retries from the latest channel, enable the service and link the kubeconfig to ~/.kube/config 2026-10-09 14:37:28 +00:00
Ruakij 4a76aa3a2e Set node-name, node-external-ip and labels_extra in the k3s config and config_extra for agents 2026-10-09 14:37:27 +00:00
Ruakij e9f1153482 Add clean_resolv_conf to the kubernetes role to give k3s a resolv.conf with only the nameserver lines 2026-10-09 14:37:27 +00:00
Ruakij ca1fcc16b6 Fall back to the default IPv4 and IPv6 address when the k3s node IP interface has none 2026-10-09 14:37:27 +00:00
Ruakij fb94fd5997 Deploy the calico operator v3.28.0 2026-10-09 14:37:26 +00:00
Ruakij 713d38d77d Shrink the default IPv6 cluster CIDR of k3s to fd42::/112 2026-10-09 14:37:26 +00:00
Ruakij bc71066de1 Run the k3s install of the kubernetes role only on target_host when it is set 2026-10-09 14:37:26 +00:00
Ruakij 5eae9ca348 Drop the docker dependency and the helm install from the kubernetes role 2026-10-09 14:37:25 +00:00
Ruakij 844e017f9e Add a tuned role that installs tuned and sets the throughput-performance profile 2026-10-09 14:37:25 +00:00
Ruakij 381f3ab7c9 Start the wireguard-ipv6-converter again whenever its bound service starts via a drop-in and always restart it on deploy 2026-10-09 14:37:24 +00:00
Ruakij 6390e6288b Disable SSH password auth in the common role only when sshd is active 2026-10-09 14:37:24 +00:00
Ruakij 13d60c4f9b Install nmon and fail2ban and upgrade packages on every distribution in the common role 2026-10-09 14:37:24 +00:00
Ruakij cb09f77b68 Enable TCP BBR with the fq qdisc on kernels from 4.9 in the common role 2026-10-09 14:37:23 +00:00
Ruakij 84fd52b678 Generate a random IPv6 stable secret once per host for the default interface in the common role 2026-10-09 14:37:23 +00:00
Ruakij c7eceae087 Ensure the .bashrc exists, expand aliases after sudo and color grep in the common role aliases 2026-10-09 14:37:23 +00:00
28 changed files with 467 additions and 137 deletions
+5
View File
@@ -5,3 +5,8 @@
systemd:
name: systemd-journald
state: restarted
- name: restart_fail2ban
systemd:
name: fail2ban
state: restarted
+36 -15
View File
@@ -1,20 +1,41 @@
- name: Ensure .bashrc exists
file:
path: "{{ ansible_facts.env.HOME }}/.bashrc"
state: touch
mode: "0644"
- name: General aliases
blockinfile:
path: "{{ ansible_facts.env.HOME }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK | General aliases"
block: |
alias clr="clear"
alias hgrep="history | grep"
alias syslog="tail -f --lines=100 /var/log/syslog"
alias cp="rsync -hlAXEptgoDS --numeric-ids --info=progress2"
path: "{{ ansible_facts.env.HOME }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK | General aliases"
block: |
alias clr="clear"
alias hgrep="history | grep"
alias syslog="tail -f --lines=100 /var/log/syslog"
alias cp="rsync -hlAXEptgoDS --numeric-ids --info=progress2"
# We can tell bash to check the next word after the alias (i.e sudo) by adding a space to the end of the alias value. https://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo
alias sudo='sudo '
- name: ls aliases and colors
blockinfile:
path: "{{ ansible_facts.env.HOME }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors"
block: |
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -la'
path: "{{ ansible_facts.env.HOME }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors"
block: |
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -la'
+9
View File
@@ -0,0 +1,9 @@
# Debian 12+ ships no syslog daemon, so there is no /var/log/auth.log and the
# file-based sshd jail refuses to start; read sshd from the journal instead.
- name: Read the sshd jail from the journal
copy:
dest: /etc/fail2ban/jail.d/sshd-systemd.conf
content: |
[sshd]
backend = systemd
notify: restart_fail2ban
+2
View File
@@ -1,5 +1,7 @@
- import_tasks: ./packages.yml
- import_tasks: ./fail2ban.yml
- import_tasks: ./ssh.yml
- import_tasks: ./packages.yml
+51 -14
View File
@@ -1,22 +1,59 @@
- name: Set sysctl settings for ip-forwarding
copy:
dest: "/etc/sysctl.d/ip-forwarding.conf"
content: |
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
dest: "/etc/sysctl.d/ip-forwarding.conf"
content: |
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
notify: reload_sysctl
- name: Set sysctl settings for ipv6-address-generation
copy:
dest: "/etc/sysctl.d/ipv6-slaac-address-generation.conf"
content: |
net.ipv6.conf.default.addr_gen_mode = 2
net.ipv6.conf.default.stable_secret = {{ ipv6_stable_secret }}
notify: reload_sysctl
- name: Check if the sysctl configuration file exists
stat:
path: "/etc/sysctl.d/ipv6-slaac-address-generation.conf"
register: sysctl_conf
- block:
# - name: Generate IPv6 stable-secret segments
# set_fact:
# stable_secret_segments: "{{ stable_secret_segments | default() + '%0x' | format(range(0, 2**(16*2)) | random(seed=ipv6_stable_secret_seed+inventory_hostname+(stable_secret_segments | default()))) }}"
# loop: "{{ range(4) }}"
# - name: Format IPv6 stable-secret segments
# set_fact:
# ipv6_stable_secret: "{{ stable_secret_segments | regex_replace('(.{4})(?=.)', '\\1:') }}"
- name: Generate random IPv6 stable-secret
set_fact:
ipv6_stable_secret: "{{ 'fd' + (lookup('password', '/dev/null length=30 chars=hex')).split('.')[0][:7] + '::' + (lookup('password', '/dev/null length=4 chars=hex')) }}"
- name: Set sysctl settings for ipv6-address-generation
copy:
dest: "/etc/sysctl.d/ipv6-slaac-address-generation.conf"
content: |
{% if ansible_facts.default_ipv6.interface is defined %}
net.ipv6.conf.{{ ansible_facts.default_ipv6.interface }}.addr_gen_mode = 2
net.ipv6.conf.{{ ansible_facts.default_ipv6.interface }}.stable_secret = {{ ipv6_stable_secret }}
{% else %}
net.ipv6.conf.{{ ansible_facts.default_ipv4.interface }}.addr_gen_mode = 2
net.ipv6.conf.{{ ansible_facts.default_ipv4.interface }}.stable_secret = {{ ipv6_stable_secret }}
{% endif %}
notify: reload_sysctl
when:
- ansible_facts.default_ipv6 is defined
- not sysctl_conf.stat.exists
- name: Set sysctl settings to override ipv6-slaac with enabled forwarding
copy:
dest: "/etc/sysctl.d/ipv6-slaac-override.conf"
content: |
net.ipv6.conf.all.accept_ra = 2
dest: "/etc/sysctl.d/ipv6-slaac-override.conf"
content: |
net.ipv6.conf.all.accept_ra = 2
notify: reload_sysctl
- name: Set sysctl settings for TCP BBR
copy:
dest: "/etc/sysctl.d/tcp-bbr.conf"
content: |
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
when:
- ansible_kernel is version('4.9', '>=')
notify: reload_sysctl
+15 -15
View File
@@ -1,20 +1,20 @@
- name: Update Packages
apt:
update_cache: yes
upgrade: yes
when: ansible_facts.distribution == "Debian"
update_cache: yes
upgrade: yes
- name: Install Packages
package:
name:
- gpg
- htop
- iotop
- slurm
- sudo
- screen
- curl
- rsync
- zstd
state: latest
when: ansible_facts.distribution == "Debian"
name:
- gpg
- htop
- iotop
- slurm
- nmon
- sudo
- screen
- curl
- rsync
- zstd
- fail2ban
state: latest
+19 -11
View File
@@ -1,12 +1,20 @@
- name: Disable SSH password auth
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication\s*yes'
line: "PasswordAuthentication no"
register: sshd_config
- name: Check if SSH daemon is active
systemd:
name: sshd
state: started
register: sshd_status
- name: Restart SSH daemon
service:
name: sshd
state: restarted
when: sshd_config.changed
- block:
- name: Disable SSH password auth
lineinfile:
dest: /etc/ssh/sshd_config
regexp: '^PasswordAuthentication\s*yes'
line: "PasswordAuthentication no"
register: sshd_config
- name: Restart SSH daemon
service:
name: sshd
state: restarted
when: sshd_config.changed
when: sshd_status.status.ActiveState == 'active'
+18 -3
View File
@@ -7,7 +7,7 @@ kubernetes:
service_cidr: 10.43.0.0/16
ipv6:
# Minimum: /120
cluster_cidr: fd42::/56
cluster_cidr: fd42::/112
service_cidr: fd43::/112
# Interface to grab node-IPv4/v6 from
@@ -19,7 +19,11 @@ kubernetes:
token: <shared token for nodes to join>
network:
# One of [flannel, calico]
# Copies the current /etc/resolv.conf whilst only keeping "nameserver" lines
# can be used to remove filter
clean_resolv_conf: false
# One of [none, flannel, calico, cilium]
plugin: calico
# Helper for networking
@@ -29,7 +33,7 @@ kubernetes:
# Helpful, when nodeIp_interface is a wireguard-interface
routingtabletowg: false
# One of [traefik-ingress]
# One of [none, traefik-ingress, nginx-ingress]
ingress_controller: traefik-ingress
# k3s version to install, e.g. v1.37.1+k3s1. An installed k3s is replaced only
@@ -48,3 +52,14 @@ kubernetes:
etcd-arg:
heartbeat-interval: 500
election-timeout: 5000
registries_config:
# Defines the names and endpoints of registries
# When embedded-registry is enabled, every registry needs to be defined here to allow this node to distribute those images.
#mirrors:
# Enable distribution for all registries
#"*": {}
# Defines authentication and extra settings for the registries
#config:
+2 -2
View File
@@ -1,3 +1,3 @@
---
dependencies:
- role: docker
#dependencies:
# - role: docker
+23 -4
View File
@@ -2,7 +2,7 @@
ansible.builtin.file:
path: /etc/rancher/k3s/
state: directory
mode: '0755'
mode: "0755"
- name: Read the live k3s config
slurp:
@@ -33,14 +33,33 @@
get_url:
url: https://get.k3s.io
dest: /root/k3s_install.sh
mode: '744'
mode: "744"
# todo: update when file changed?
- name: Read the live registries.yaml
slurp:
src: /etc/rancher/k3s/registries.yaml
register: live_registries
failed_when: false
when: "type == 'server'"
# Written only on a change k3s would see, like config.yaml
- name: Deploy registries.yaml
ansible.builtin.template:
src: k3s/server/registries.yaml.j2
dest: /etc/rancher/k3s/registries.yaml
register: registries_config
when:
- "type == 'server'"
- >-
live_registries.content is not defined or
(live_registries.content | b64decode | from_yaml) != (lookup('template', 'k3s/server/registries.yaml.j2') | from_yaml)
- import_tasks: ./install/server/setup_network.yml
when: "type == 'server'"
- import_tasks: ./install/server/install_helm.yml
when: "type == 'server'"
#- import_tasks: ./install/server/install_helm.yml
# when: "type == 'server'"
- import_tasks: ./install/server/install_k3s.yml
when: "type == 'server'"
+40 -53
View File
@@ -1,63 +1,50 @@
- name: Install K3s-server for 1st-node
command: /root/k3s_install.sh {{ type }}
environment:
INSTALL_K3S_VERSION: "{{ kubernetes.version }}"
when:
- "inventory_hostname == groups['kubernetes'][0]"
- k3s_installed.rc != 0 or (kubernetes.version != '' and ('k3s version ' ~ kubernetes.version ~ ' ') not in k3s_installed.stdout)
register: command
changed_when: "'No change detected' not in command.stdout"
- block:
- name: Install K3s-server
command: /root/k3s_install.sh {{ type }}
environment:
INSTALL_K3S_CHANNEL: latest
INSTALL_K3S_VERSION: "{{ kubernetes.version }}"
when: k3s_installed.rc != 0 or (kubernetes.version != '' and ('k3s version ' ~ kubernetes.version ~ ' ') not in k3s_installed.stdout)
register: command
changed_when: "'No change detected' not in command.stdout"
until: "command is not failed"
retries: 2
delay: 10
- name: Make sure service is started / restarted on config change
service:
name: k3s
state: "{{ 'restarted' if not command.changed and config.changed else 'started' }}"
when: "inventory_hostname == groups['kubernetes'][0]"
- name: Make sure service is started / restarted on config change
service:
name: k3s
enabled: true
state: "{{ 'restarted' if not command.changed and (config.changed or registries_config.changed) else 'started' }}"
- name: Waiting for K3s-server to accept connections
ansible.builtin.wait_for:
host: "{{ inventory_hostname }}"
port: 6443
state: started
when: "inventory_hostname == groups['kubernetes'][0]"
- name: Waiting for K3s-server to accept connections
ansible.builtin.wait_for:
host: "{{ inventory_hostname }}"
port: 6443
state: started
throttle: 1
- name: Install K3s-server for other nodes
command: /root/k3s_install.sh {{ type }}
environment:
INSTALL_K3S_VERSION: "{{ kubernetes.version }}"
when:
- "inventory_hostname != groups['kubernetes'][0]"
- k3s_installed.rc != 0 or (kubernetes.version != '' and ('k3s version ' ~ kubernetes.version ~ ' ') not in k3s_installed.stdout)
register: command
changed_when: "'No change detected' not in command.stdout"
until: "command is not failed"
retries: 2
delay: 10
- name: Ensure the .kube directory exists
file:
path: "~/.kube"
state: directory
mode: "0755"
- name: Make sure service is started / restarted on config change
service:
name: k3s
state: "{{ 'restarted' if not command.changed and config.changed else 'started' }}"
when: "inventory_hostname != groups['kubernetes'][0]"
- name: Waiting for K3s-server to accept connections on other nodes
ansible.builtin.wait_for:
host: "{{ inventory_hostname }}"
port: 6443
state: started
when: "inventory_hostname != groups['kubernetes'][0]"
#- name: Add Kubernetes environment-vars to /etc/profile.d/
# blockinfile:
# path: /etc/profile.d/k3s-bin.sh
# marker: "# {mark} ANSIBLE MANAGED BLOCK | k3s"
# block: |
# export KUBECONFIG="/etc/rancher/k3s/k3s.yaml"
# create: true
- name: Create symbolic link for k3s.yaml
file:
src: "/etc/rancher/k3s/k3s.yaml"
dest: "~/.kube/config"
state: link
- name: Deploy calico
import_tasks: ./roles/kubernetes/tasks/install/server/network-plugin/deploy_calico.yml
when: "kubernetes.network.plugin == 'calico'"
when:
- "kubernetes.network.plugin == 'calico'"
- name: Deploy cilium
import_tasks: ./roles/kubernetes/tasks/install/server/network-plugin/deploy_cilium.yml
when:
- "kubernetes.network.plugin == 'cilium'"
- name: Deploy network-helpers
import_tasks: ./roles/kubernetes/tasks/install/server/network-plugin/deploy_network_helper.yml
@@ -1,10 +1,10 @@
- name: Deploy calico operator
command: kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/tigera-operator.yaml
command: kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.0/manifests/tigera-operator.yaml
register: command
changed_when: "'created' in command.stdout"
run_once: true
failed_when:
- "command.rc == 1 and 'AlreadyExists' not in command.stderr"
- "command.rc == 1 and 'AlreadyExists' not in command.stderr"
- name: Deploy calico ressource template
ansible.builtin.template:
@@ -0,0 +1,71 @@
- name: Check if already installed in cluster
command: "cilium status"
register: cilium_status
ignore_errors: true
changed_when: false
check_mode: false
run_once: true
- name: Check if the Cilium CLI is installed
stat:
path: /usr/local/bin/cilium
register: cilium_cli
- name: Get Cilium CLI version
ansible.builtin.command:
argv:
- curl
- -s
- https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt
register: cilium_cli_version
check_mode: no
changed_when: false
run_once: true
- name: Determine CLI architecture
set_fact:
cli_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
run_once: true
- name: Download and verify Cilium CLI
block:
- name: Download Cilium CLI tar.gz file
get_url:
url: "https://github.com/cilium/cilium-cli/releases/download/{{ cilium_cli_version.stdout }}/cilium-linux-{{ cli_arch }}.tar.gz"
dest: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
checksum: "sha256:{{ lookup('url', 'https://github.com/cilium/cilium-cli/releases/download/' + cilium_cli_version.stdout + '/cilium-linux-' + cli_arch + '.tar.gz.sha256sum', wantlist=True)[0].split(' ')[0] }}"
mode: '0755'
- name: Extract Cilium CLI tar.gz to /usr/local/bin
unarchive:
src: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
dest: "/usr/local/bin"
remote_src: yes
#extra_opts: ["--strip-components=1"]
mode: 777
# An installed CLI is left alone, not upgraded to the latest release
when: cilium_cli_version.stdout is defined and not cilium_cli.stat.exists
become: yes
- name: Clean up temporary files
file:
path: "/tmp/cilium-linux-{{ cli_arch }}.tar.gz"
state: absent
# Install cilium via cli
- block:
- name: Install cilium
command: >
cilium install
--set
imap.mode=kubernetes,
ipv6.enabled=true,
#ipam.operator.clusterPoolIPv4PodCIDRList={{ kubernetes.ipPool.ipv4.cluster_cidr }},
#ipam.operator.clusterPoolIPv6PodCIDRList={{ kubernetes.ipPool.ipv6.cluster_cidr }}
- name: Wait for cilium
command: cilium status --wait
changed_when: false
run_once: true
when:
- cilium_status.rc != 0
+1 -1
View File
@@ -3,4 +3,4 @@
- import_tasks: ./node.yml
- import_tasks: ./install.yml
when: target_host is not defined or inventory_hostname == target_host
+33 -14
View File
@@ -7,11 +7,11 @@
copy:
dest: "/etc/sysctl.d/kubernetes.conf"
content: |
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1
notify: reload_sysctl
#- name: Disable swap
@@ -19,15 +19,15 @@
- name: Install required packages
package:
name:
#- containerd
#- iptables
# For Longhorn:
- nfs-common
- open-iscsi
state: present
name:
#- containerd
#- iptables
# For Longhorn:
- nfs-common
- open-iscsi
state: present
- import_tasks: ./prerequisites/containerd.yml
- import_tasks: ./prerequisites/containerd.yml
- name: Gather interface-name
set_fact:
@@ -35,8 +35,27 @@
- name: Getting nodeIp-data from interface
set_fact:
nodeip_ipv4: "{{ ansible_facts[ interface ].ipv4.address }}"
nodeip_ipv6: "{{ ansible_facts[ interface ].ipv6[0].address if ansible_facts[ interface ].ipv6 is defined }}"
nodeip_ipv4: >-
{{ (ansible_facts[interface].ipv4.address)
if (ansible_facts is defined and ansible_facts.get(interface) is defined and ansible_facts[interface].ipv4 is defined)
else (ansible_default_ipv4.address | default('')) }}
nodeip_ipv6: >-
{{ (ansible_facts[interface].ipv6[0].address)
if (ansible_facts is defined and ansible_facts.get(interface) is defined and ansible_facts[interface].ipv6 is defined and (ansible_facts[interface].ipv6 | length) > 0)
else (ansible_default_ipv6.address | default('')) }}
- block:
- name: Read resolv.conf
shell: "grep '^nameserver' /etc/resolv.conf"
register: nameserver_line
changed_when: false
check_mode: false
- name: Write /etc/resolv-k3s.conf with only nameservers
copy:
content: "{{ nameserver_line.stdout }}"
dest: /etc/resolv-k3s.conf
when: kubernetes.network.clean_resolv_conf is true
- name: Run handlers to reload configurations
meta: flush_handlers
@@ -1,12 +1,37 @@
{% set disabled_components = [] %}
## Base ##
node-name: {{ ansible_fqdn }}
# Join cluster
server: https://{{ hostvars[groups['kubernetes'][0]]['nodeip_ipv4'] }}:6443
token: '{{ kubernetes.token }}'
# Networking
{% if ansible_default_ipv6 is defined %}
node-external-ip: {{ ansible_default_ipv4.address }},{{ ansible_default_ipv6.address }}
{% else %}
node-external-ip: {{ ansible_default_ipv4.address }}
{% endif %}
{% if kubernetes.network.clean_resolv_conf %}
resolv-conf: /etc/resolv-k3s.conf
{% endif %}
{% if nodeip_ipv6 != "" and kubernetes.ipPool.ipv6 is defined %}
node-ip: {{ nodeip_ipv4 }},{{ nodeip_ipv6 }}
{% else %}
node-ip: {{ nodeip_ipv4 }}
{% endif %}
# Network-plugin
{% if kubernetes.network.plugin == "flannel" %}
{% else %}
{% if kubernetes.network.plugin == "cilium" %}
# Cilium requires servicelb to be disabled when replacing kube-proxy
{% set _ = disabled_components.append('servicelb') %}
{% endif %}
{% endif %}
## Label
# Region & DC
node-label:
@@ -16,3 +41,13 @@ node-label:
{% if zone is defined %}
- topology.kubernetes.io/zone={{ zone }}
{% endif %}
{% for item in kubernetes.labels_extra %}
- {{ item }}
{% endfor %}
# Disabled components
{% if disabled_components %}
disable: {{ disabled_components | join(',') }}
{% endif %}
{{ kubernetes.config_extra | to_yaml }}
@@ -1,8 +1,12 @@
{% set disabled_components = [] %}
## Base ##
node-name: {{ ansible_fqdn }}
{% if inventory_hostname == groups['kubernetes'][0] %}
# Initialize with internal etcd
cluster-init: true
{% else %}
# Join cluster
server: https://{{ hostvars[groups['kubernetes'][0]]['nodeip_ipv4'] }}:6443
{% endif %}
@@ -11,6 +15,16 @@ tls-san:
- {{ kubernetes.control_plane.dns_name }}
# Networking
{% if ansible_default_ipv6 is defined and ansible_default_ipv6.address is defined %}
node-external-ip: {{ ansible_default_ipv4.address }},{{ ansible_default_ipv6.address }}
{% else %}
node-external-ip: {{ ansible_default_ipv4.address }}
{% endif %}
{% if kubernetes.network.clean_resolv_conf %}
resolv-conf: /etc/resolv-k3s.conf
{% endif %}
{% if nodeip_ipv6 != "" and kubernetes.ipPool.ipv6 is defined %}
node-ip: {{ nodeip_ipv4 }},{{ nodeip_ipv6 }}
cluster-cidr: {{ kubernetes.ipPool.ipv4.cluster_cidr }},{{ kubernetes.ipPool.ipv6.cluster_cidr }}
@@ -34,11 +48,15 @@ flannel-backend: vxlan
{% else %}
disable-network-policy: true
flannel-backend: none
{% if kubernetes.network.plugin == "cilium" %}
# Cilium requires servicelb to be disabled when replacing kube-proxy
{% set _ = disabled_components.append('servicelb') %}
{% endif %}
{% endif %}
# Ingress-plugin
{% if kubernetes.ingress_controller != "traefik-ingress" %}
disable: traefik
{% set _ = disabled_components.append('traefik') %}
{% endif %}
## Label
@@ -50,6 +68,16 @@ node-label:
{% if zone is defined %}
- topology.kubernetes.io/zone={{ zone }}
{% endif %}
{% if kubernetes.labels_extra is defined %}
{% for item in kubernetes.labels_extra %}
- {{ item }}
{% endfor %}
{% endif %}
# Disabled components
{% if disabled_components %}
disable: {{ disabled_components | join(',') }}
{% endif %}
{{ kubernetes.config_extra | to_yaml }}
@@ -0,0 +1 @@
{{ kubernetes.registries_config | to_nice_yaml(indent=2) }}
+1
View File
@@ -0,0 +1 @@
DPkg::Post-Invoke { "/usr/local/sbin/pve-no-nag"; };
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
# Disables the "No valid subscription" dialog of the Proxmox web UI. Called by the apt hook
# 86pve-no-nag, because every proxmox-widget-toolkit update restores the file. Without a match
# (changed upstream code) the dialog returns and nothing breaks.
f=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
[ -f "$f" ] && sed -i 's/checked_command: function (orig_cmd) {$/& orig_cmd(); return;/' "$f"
exit 0
+15
View File
@@ -0,0 +1,15 @@
- name: Install the subscription nag remover
copy:
src: pve-no-nag
dest: /usr/local/sbin/pve-no-nag
mode: "0755"
- name: Run it after every dpkg run
copy:
src: 86pve-no-nag
dest: /etc/apt/apt.conf.d/86pve-no-nag
mode: "0644"
- name: Remove the subscription nag
command: /usr/local/sbin/pve-no-nag
changed_when: false
+2
View File
@@ -0,0 +1,2 @@
tuned:
profile:
+6
View File
@@ -0,0 +1,6 @@
- name: Install Packages
package:
name:
- tuned
- tuned-utils
- tuned-utils-systemtap
+5
View File
@@ -0,0 +1,5 @@
- import_tasks: ./install-packages.yml
- import_tasks: ./setup-service.yml
- import_tasks: ./set-profile.yml
+5
View File
@@ -0,0 +1,5 @@
- name: Set profile
command: tuned-adm profile throughput-performance
register: command
failed_when:
- "command.rc != 0"
+5
View File
@@ -0,0 +1,5 @@
- name: Make sure service is started
service:
name: tuned
enabled: true
state: "started"
@@ -10,10 +10,30 @@
daemon-reload: true
enabled: true
- name: Ensure drop-in directory for the bound service exists
ansible.builtin.file:
path: /etc/systemd/system/{{ wireguard_ipv6_converter.service.bindTo }}.d
state: directory
mode: "0755"
when: "wireguard_ipv6_converter.service.bindTo is defined"
- name: Deploy start-propagation drop-in for the bound service
ansible.builtin.template:
src: wg-ipv6-conv-restart.conf.jinja2
dest: /etc/systemd/system/{{ wireguard_ipv6_converter.service.bindTo }}.d/10-wg-ipv6-converter_{{ wireguard_ipv6_converter.setup.interface }}.conf
mode: "0644"
when: "wireguard_ipv6_converter.service.bindTo is defined"
register: upholdsFile
- name: Reload systemd for drop-in
ansible.builtin.systemd:
daemon_reload: true
when: "upholdsFile.changed"
- name: Start service if interface exists already
ansible.builtin.service:
name: wg-ipv6-converter_{{ wireguard_ipv6_converter.setup.interface }}
state: "{{ 'restarted' if deployDownload.changed or serviceFile.changed else 'started' }}"
state: "restarted"
register: service
when: "wireguard_ipv6_converter.setup.interface in ansible_interfaces"
@@ -0,0 +1,7 @@
# BindsTo= in the converter unit only propagates stop, so a restart of
# {{ wireguard_ipv6_converter.service.bindTo }} leaves the converter dead and the re-created
# interface without its IPv6 addresses. Start it again whenever
# {{ wireguard_ipv6_converter.service.bindTo }} starts. --no-block because the converter orders
# itself After={{ wireguard_ipv6_converter.service.bindTo }}.
[Service]
ExecStartPost=/bin/systemctl --no-block start wg-ipv6-converter_{{ wireguard_ipv6_converter.setup.interface }}.service