Files
cluster-init/ansible/playbooks/01-common.yml
2026-06-14 14:21:09 +07:00

41 lines
946 B
YAML

---
- name: Common OS prerequisites for all k8s nodes
hosts: k8s
become: true
tasks:
- name: Disable swap now
command: swapoff -a
when: ansible_facts['swaptotal_mb'] > 0
- name: Remove swap from /etc/fstab
replace:
path: /etc/fstab
regexp: '^([^#].*\s+swap\s+.*)$'
replace: '# \1'
- name: Load kernel modules at boot
copy:
dest: /etc/modules-load.d/k8s.conf
content: |
overlay
br_netfilter
- name: Load kernel modules now
modprobe:
name: "{{ item }}"
loop:
- overlay
- br_netfilter
- name: Set sysctl for k8s networking
copy:
dest: /etc/sysctl.d/k8s.conf
content: |
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
- name: Apply sysctl
command: sysctl --system