73 lines
2.3 KiB
YAML
73 lines
2.3 KiB
YAML
---
|
|
- name: Install k8s
|
|
become: true
|
|
hosts: all
|
|
|
|
vars:
|
|
arch: "amd64"
|
|
os: "Debian_11"
|
|
k8s_version: "1.27"
|
|
k_version: "{{ k8s_version }}.2"
|
|
|
|
tasks:
|
|
- name: Copy conf
|
|
copy:
|
|
src: rootfs/
|
|
dest: /
|
|
|
|
- name: Upgrade
|
|
apt:
|
|
update_cache: true
|
|
cache_valid_time: 604800 # 60s * 60m * 24h * 7d
|
|
upgrade: full
|
|
|
|
- name: Install deps
|
|
apt:
|
|
name:
|
|
- gpg
|
|
- vim
|
|
|
|
- name: Add libcontainers repo key (CRI-O)
|
|
apt_key:
|
|
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ os }}/Release.key"
|
|
keyring: /etc/apt/trusted.gpg.d/libcontainers-archive-keyring.gpg
|
|
- name: Add libcontainers-crio repo key (CRI-O)
|
|
apt_key:
|
|
url: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ k8s_version }}/{{ os }}/Release.key"
|
|
keyring: /etc/apt/trusted.gpg.d/libcontainers-crio-archive-keyring.gpg
|
|
- name: Add libcontainers repo (CRI-O)
|
|
apt_repository:
|
|
repo: "deb [signed-by=/etc/apt/trusted.gpg.d/libcontainers-archive-keyring.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/{{ os }}/ /"
|
|
filename: devel:kubic:libcontainers:stable.list
|
|
- name: Add libcontainers-crio repo (CRI-O)
|
|
apt_repository:
|
|
repo: "deb [signed-by=/etc/apt/trusted.gpg.d/libcontainers-crio-archive-keyring.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/{{ k8s_version }}/{{ os }}/ /"
|
|
filename: "devel:kubic:libcontainers:stable:cri-o:{{ k8s_version }}.list"
|
|
- name: Install cri-o
|
|
apt:
|
|
name:
|
|
- cri-o
|
|
- cri-o-runc
|
|
update_cache: true
|
|
|
|
- name: Install kubectl
|
|
get_url:
|
|
url: "https://dl.k8s.io/release/v{{ k_version }}/bin/linux/{{ arch }}/kubectl"
|
|
dest: /usr/local/bin/kubectl
|
|
mode: 755
|
|
- name: Install kubeadm
|
|
get_url:
|
|
url: "https://dl.k8s.io/release/v{{ k_version}}/bin/linux/{{ arch }}/kubeadm"
|
|
dest: /usr/local/bin/kubeadm
|
|
mode: 755
|
|
- name: Install kubelet
|
|
get_url:
|
|
url: "https://dl.k8s.io/release/v{{ k_version }}/bin/linux/{{ arch }}/kubelet"
|
|
dest: /usr/local/bin/kubelet
|
|
mode: 755
|
|
- name: Start kubelet service
|
|
service:
|
|
name: kubelet.service
|
|
enabled: true
|
|
state: started
|