kube: cut config drift and standardize apt repos

This commit is contained in:
2025-07-09 17:12:33 +03:00
parent 9fd08a0d22
commit de8b90fcc5

View File

@@ -23,11 +23,6 @@
ansible.builtin.shell: update-grub ansible.builtin.shell: update-grub
when: grub_defaults.changed when: grub_defaults.changed
- name: Ensure nfs-common is installed
ansible.builtin.apt:
name: nfs-common
state: present
- name: Reconfigure Kubernetes nodes - name: Reconfigure Kubernetes nodes
hosts: kubernetes hosts: kubernetes
vars: vars:
@@ -35,35 +30,17 @@
CRIO_VERSION: v1.33 CRIO_VERSION: v1.33
IP: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" IP: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
tasks: tasks:
- name: Remove APT packages
ansible.builtin.apt:
name: "{{ item }}"
state: absent
loop:
- kubelet
- kubeadm
- kubectl
- name: Delete old repos
ansible.builtin.shell: "rm /etc/apt/sources.list.d/kubernetes.list"
changed_when: false
failed_when: false
- name: Delete old repos
ansible.builtin.shell: "rm -rf /etc/apt/sources.list.d/devel*"
changed_when: false
failed_when: false
- name: Add cri-o apt signing key - name: Add cri-o apt signing key
ansible.builtin.apt_key: get_url:
url: "https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/Release.key" url: https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/Release.key
state: present dest: /usr/share/keyrings/cri-o.asc
mode: ugo+rw
- name: Add cri-o apt repo - name: Add cri-o apt repo
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
repo: "deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/ /" repo: "deb [signed-by=/usr/share/keyrings/cri-o.asc] https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/ /"
state: present state: present
filename: crio filename: cri-o
- name: Install cri-o and conntrack - name: Install cri-o and conntrack
ansible.builtin.apt: ansible.builtin.apt:
@@ -71,7 +48,7 @@
state: latest state: latest
loop: loop:
- cri-o - cri-o
- conntrack - conntrack
- name: Enable crio service - name: Enable crio service
ansible.builtin.systemd_service: ansible.builtin.systemd_service: