🏗️」 wip: work in progress, not done yet.

This commit is contained in:
2025-08-12 20:55:11 +02:00
parent d7bc6cb929
commit a77f436878
8 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,15 @@
gpg_keys:
- key: https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key
repositories:
- repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /"
https_packages:
- name: apt-transport-https
- name: curl
- name: gpg
k8s_packages:
- name: kubeadm
- name: kubelet
- name: kubectl

View File

@ -0,0 +1,2 @@
---
dependencies: []

View File

@ -0,0 +1,60 @@
---
- name: Install packages that allow apt to be used over HTTPS
apt:
name='{{ item.name }}'
state=present
update_cache=yes
with_items: "{{ https_packages | default([]) }}"
- name: Ensure keyrings directory exists
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Download and install Kubernetes apt GPG key (dearmored)
shell: |
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.33/deb/Release.key | gpg --dearmor | tee /etc/apt/keyrings/kubernetes-apt-keyring.gpg > /dev/null
args:
creates: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
- name: Add Kubernetes apt repository
apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.33/deb/ /"
filename: kubernetes
state: present
- name: Remove swapfile from /etc/fstab
mount:
name: "{{ item }}"
fstype: swap
state: absent
with_items:
- swap
- none
- name: Disable swap
command: swapoff -a
when: ansible_swaptotal_mb > 0
- name: Install Kubernetes binaries
apt:
name="{{ item.name }}"
state=present
update_cache=yes
with_items: "{{ k8s_packages | default([]) }}"
- name: Configure node ip
lineinfile:
path: '/etc/systemd/system/kubelet.service.d/10-kubeadm.conf'
line: 'Environment="KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }}"'
regexp: 'KUBELET_EXTRA_ARGS='
insertafter: '\[Service\]'
state: present
notify:
- restart kubelet