Add 'k8s/upgrde_26_27.yml'
This commit is contained in:
36
k8s/upgrde_26_27.yml
Normal file
36
k8s/upgrde_26_27.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
- name: Upgrade from 1.26 to 1.27
|
||||||
|
hosts: root_master
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
become_user: root
|
||||||
|
tasks:
|
||||||
|
- name: Check if keyring exists
|
||||||
|
stat:
|
||||||
|
path: /etc/apt/keyrings/kubernetes-apt-keyring{{ K8S_TARGET_VERSION}}.gpg
|
||||||
|
register: keyring_file
|
||||||
|
- name: Install certificate
|
||||||
|
command: "{{ item }} chdir=/tmp"
|
||||||
|
with_items:
|
||||||
|
- "curl -o Release.key -fsSL https://pkgs.k8s.io/core:/stable:/{{ K8S_TARGET_VERSION }}/deb/Release.key"
|
||||||
|
- "gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring{{ K8S_TARGET_VERSION }}.gpg Release.key"
|
||||||
|
- "rm Release.key"
|
||||||
|
when: not keyring_file.stat.exists
|
||||||
|
- name: Check if apt repo exists
|
||||||
|
stat:
|
||||||
|
path: /etc/apt/sources.list.d/kubernetes_{{ K8S_TARGET_VERSION}}.list
|
||||||
|
register: apt_repo
|
||||||
|
- name: Setup APT repo
|
||||||
|
copy:
|
||||||
|
dest: /etc/apt/sources.list.d/kubernetes_{{ K8S_TARGET_VERSION}}.list
|
||||||
|
content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring{{ K8S_TARGET_VERSION}}.gpg] https://pkgs.k8s.io/core:/stable:/{{ K8S_TARGET_VERSION }}/deb/ /"
|
||||||
|
when: not apt_repo.stat.exists
|
||||||
|
- name: Update cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
- name: Unhold packages
|
||||||
|
dpkg_selections:
|
||||||
|
name: "{{ item }}"
|
||||||
|
selection: unhold
|
||||||
|
with_items:
|
||||||
|
- "kubelet"
|
||||||
|
- "kubeadm"
|
Reference in New Issue
Block a user