From 98de636298e2e6312f01be9f3a433c6a244a80be Mon Sep 17 00:00:00 2001 From: Emil Dabrowski Date: Tue, 10 Jan 2023 21:46:19 +0100 Subject: [PATCH] Parametarize K8s and Ubuntu version --- playbooks/kubernetes/group_vars/all.yml | 1 + roles/kubernetes/any/tasks/main.yml | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/playbooks/kubernetes/group_vars/all.yml b/playbooks/kubernetes/group_vars/all.yml index b306b1a..6d63c34 100644 --- a/playbooks/kubernetes/group_vars/all.yml +++ b/playbooks/kubernetes/group_vars/all.yml @@ -1,3 +1,4 @@ pod_network_cidr: "10.254.0.0/16" service_cidr: "10.255.0.0/16" kubeadmin_config: /etc/kubernetes/admin.conf +k8s_version: 1.26 diff --git a/roles/kubernetes/any/tasks/main.yml b/roles/kubernetes/any/tasks/main.yml index ee85d0f..c41d54e 100644 --- a/roles/kubernetes/any/tasks/main.yml +++ b/roles/kubernetes/any/tasks/main.yml @@ -84,8 +84,7 @@ - name: Setup CRI-O become: true vars: - os: xUbuntu_22.04 # fetch this from os-release - version: 1.24 + os: xUbuntu_{{ ansible_distribution_version}} key_dir: /usr/share/keyrings keys: { @@ -96,13 +95,13 @@ }, "libcontainers-crio": { - "url": "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ version }}/{{ os }}/Release.key", + "url": "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ k8s_version }}/{{ os }}/Release.key", "name": "libcontainers-crio-archive-keyring", }, } repos: - deb [signed-by={{ key_dir }}/libcontainers-archive-keyring.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ os }}/ / - - deb [signed-by={{ key_dir }}/libcontainers-crio-archive-keyring.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ version }}/{{ os }}/ / + - deb [signed-by={{ key_dir }}/libcontainers-crio-archive-keyring.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ k8s_version }}/{{ os }}/ / block: - name: Download signing keys with_dict: "{{ keys }}"