From 6a4865d5d55bbc1215f07552f176affa5791456f Mon Sep 17 00:00:00 2001 From: alecsandru Date: Sat, 4 May 2024 08:42:39 +0000 Subject: [PATCH] initial --- install_kubetools.yml | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 install_kubetools.yml diff --git a/install_kubetools.yml b/install_kubetools.yml new file mode 100644 index 0000000..223dcd0 --- /dev/null +++ b/install_kubetools.yml @@ -0,0 +1,53 @@ +- name: Install Kube tools (Kubeadm, Kubelet, Kubectl) using OS tools + hosts: all + become: yes + become_method: sudo + become_user: root + tasks: + - name: Install apt tools and accesories + package: + name: {{ item }} + state: present + with_items: + - apt-transport-https + - ca-certificates + - curl + - gpg + - name: Creates keyrings directory + file: + path: /etc/apt/keyrings + state: directory + mode: '755' + - name: Install certificate + command: "{{ item }} chdir=/tmp" + with_items: + - "curl -fsSL https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/Release.key" + - "gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg Release.key" + - "rm Release.key" + - name: Setup APT repo + copy: + dest: /etc/apt/sources.list.d/kubernetes.list + content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/{{ K8S_VERSION }}/deb/ /" + - name: Update cache + apt: + update_cache: yes + - name: Setup tools + package: + name: {{ item }} + state: present + with_items: + - kubelet + - kubeadm + - kubectl + - name: Hold packages + dpkg_selections: + name: {{ item }} + selection: hold + with_items: + - kubelet + - kubeadm + - name: Start kubelet + service: + name: kubelet + enabled: true + state: started \ No newline at end of file