You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
homelab/install_kubetools.yml

53 lines
1.4 KiB

9 months ago
- 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"
9 months ago
- 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"
9 months ago
- name: Hold packages
dpkg_selections:
name: {{ item }}
selection: hold
with_items:
- "kubelet"
- "kubeadm"
9 months ago
- name: Start kubelet
service:
name: kubelet
enabled: true
state: started