manage cri-o on kubernetes nodes

This commit is contained in:
Erki Aas 2024-08-14 18:22:53 +03:00
parent 8529e7c0cc
commit 7958c0c7a9

View File

@ -33,6 +33,7 @@
hosts: kubernetes hosts: kubernetes
vars: vars:
KUBERNETES_VERSION: v1.30.3 KUBERNETES_VERSION: v1.30.3
CRIO_VERSION: v1.30
IP: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" IP: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
tasks: tasks:
- name: Remove APT packages - name: Remove APT packages
@ -44,6 +45,32 @@
- kubeadm - kubeadm
- kubectl - 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
ansible.builtin.apt_key:
url: "https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/Release.key"
state: present
- name: Add cri-o apt repo
ansible.builtin.apt_repository:
repo: "deb https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ CRIO_VERSION }}/deb/ /"
state: present
filename: crio
- name: Install cri-o
ansible.builtin.apt:
name: cri-o
state: latest
- name: Download kubectl, kubeadm, kubelet - name: Download kubectl, kubeadm, kubelet
ansible.builtin.get_url: ansible.builtin.get_url:
url: "https://cdn.dl.k8s.io/release/{{ KUBERNETES_VERSION }}/bin/linux/{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}/{{ item }}" url: "https://cdn.dl.k8s.io/release/{{ KUBERNETES_VERSION }}/bin/linux/{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}/{{ item }}"