mirror of
https://github.com/Noratrieb/vmlab.git
synced 2026-01-14 08:35:11 +01:00
62 lines
No EOL
2.2 KiB
YAML
62 lines
No EOL
2.2 KiB
YAML
# ====================
|
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
|
- name: Add K8s key
|
|
ansible.builtin.apt_key:
|
|
url: "https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key"
|
|
keyring: /etc/apt/keyrings/kubernetes-apt-keyring.gpg
|
|
- name: Add K8s apt repo
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /"
|
|
filename: kubernetes
|
|
- name: Install K8s tools
|
|
ansible.builtin.apt:
|
|
name:
|
|
- kubelet
|
|
- kubeadm
|
|
- kubectl
|
|
- name: Hold kubeadm
|
|
ansible.builtin.dpkg_selections:
|
|
name: "{{ item }}"
|
|
selection: hold
|
|
loop:
|
|
- kubelet
|
|
- kubeadm
|
|
- kubectl
|
|
# ====================
|
|
# https://github.com/containerd/containerd/blob/main/docs/getting-started.md
|
|
# https://docs.docker.com/engine/install/ubuntu/
|
|
- name: Add docker key
|
|
ansible.builtin.command:
|
|
cmd: "curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc"
|
|
creates: /etc/apt/keyrings/docker.asc
|
|
- name: Add Docker apt repo
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu jammy stable"
|
|
filename: docker
|
|
- name: Install containerd/runc
|
|
ansible.builtin.apt:
|
|
name: containerd.io
|
|
- name: Configure containerd to use systemd cgroups
|
|
ansible.builtin.copy:
|
|
src: "containerd-config.toml"
|
|
dest: "/etc/containerd/config.toml"
|
|
mode: "u=r,g=r,o=r"
|
|
notify:
|
|
- "Containerd config changed"
|
|
- name: Create /opt/cni/bin
|
|
ansible.builtin.file:
|
|
path: /opt/cni/bin
|
|
state: directory
|
|
mode: "u=rwx,g=rx,o=rx"
|
|
- name: Download CNI plugins
|
|
ansible.builtin.get_url:
|
|
url: "https://github.com/containernetworking/plugins/releases/download/{{ cni_plugins_version }}/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
|
dest: "/tmp/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
|
- name: Install CNI plugins
|
|
ansible.builtin.command:
|
|
cmd: "tar Cxzvf /opt/cni/bin /tmp/cni-plugins-linux-amd64-{{ cni_plugins_version }}.tgz"
|
|
creates: /opt/cni/bin/tap
|
|
- name: Start contained
|
|
ansible.builtin.service:
|
|
state: started
|
|
name: containerd |