This commit is contained in:
Lauri Võsandi 2024-07-27 11:46:39 +03:00
parent 97563e8092
commit 32fbd498cf

View File

@ -2,7 +2,7 @@
- name: Reconfigure Kubernetes nodes - name: Reconfigure Kubernetes nodes
hosts: kubernetes hosts: kubernetes
vars: vars:
KUBERNETES_VERSION: v1.27.16 KUBERNETES_VERSION: v1.28.12
tasks: tasks:
- name: Remove APT packages - name: Remove APT packages
ansible.builtin.apt: ansible.builtin.apt:
@ -13,23 +13,33 @@
- kubeadm - kubeadm
- kubectl - kubectl
- name: Download kubectl - 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' }}/kubectl" url: "https://cdn.dl.k8s.io/release/{{ KUBERNETES_VERSION }}/bin/linux/{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}/{{ item }}"
dest: /usr/bin/kubectl dest: "/usr/bin/{{ item }}-{{ KUBERNETES_VERSION }}"
mode: '0755' mode: '0755'
loop:
- kubelet
- kubectl
- kubeadm
- name: Download kubeadm - name: Create symlinks for kubectl, kubeadm, kubelet
ansible.builtin.get_url: ansible.builtin.file:
url: "https://cdn.dl.k8s.io/release/{{ KUBERNETES_VERSION }}/bin/linux/{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}/kubeadm" src: "/usr/bin/{{ item }}-{{ KUBERNETES_VERSION }}"
dest: /usr/bin/kubeadm dest: "/usr/bin/{{ item }}"
mode: '0755' state: link
loop:
- kubelet
- kubectl
- kubeadm
register: kubelet
- name: Download kubelet - name: Restart Kubelet
ansible.builtin.get_url: service:
url: "https://cdn.dl.k8s.io/release/{{ KUBERNETES_VERSION }}/bin/linux/{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}/kubelet" name: kubelet
dest: /usr/bin/kubelet enabled: true
mode: '0755' state: restarted
when: kubelet.changed
- name: Create /etc/systemd/system/kubelet.service - name: Create /etc/systemd/system/kubelet.service
ansible.builtin.copy: ansible.builtin.copy: