Files
cluster-init/ansible/playbooks/03-containerd.yml
2026-06-14 14:21:09 +07:00

36 lines
965 B
YAML

---
- name: Install and configure containerd
hosts: k8s
become: true
tasks:
- name: Add Docker CE repo (provides containerd.io)
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
- name: Install containerd
dnf:
name: containerd.io
state: present
- name: Create containerd config directory
file:
path: /etc/containerd
state: directory
- name: Generate default containerd config (overwrites Docker CE default which disables CRI)
shell: containerd config default > /etc/containerd/config.toml
- name: Enable SystemdCgroup in containerd config
replace:
path: /etc/containerd/config.toml
regexp: 'SystemdCgroup = false'
replace: 'SystemdCgroup = true'
- name: Enable and start containerd
systemd:
name: containerd
enabled: true
state: restarted