add: ansible k8s_node role

This commit is contained in:
2026-09-09 20:34:37 +00:00
parent 4960bbc9fb
commit 59e6c3ca63
8 changed files with 206 additions and 1 deletions
@@ -0,0 +1,34 @@
---
- name: Install containerd
ansible.builtin.apt:
name: containerd
state: present
update_cache: true
become: yes
- name: Create containerd configuration directory
ansible.builtin.file:
path: /etc/containerd
state: directory
mode: "0755"
become: yes
- name: Generate default containerd configuration
ansible.builtin.shell:
cmd: containerd config default > /etc/containerd/config.toml
creates: /etc/containerd/config.toml
become: yes
- name: Enable systemd cgroup driver in containerd
ansible.builtin.replace:
path: /etc/containerd/config.toml
regexp: '^(\s*)SystemdCgroup(\s*=\s*)false'
replace: '\1SystemdCgroup\2true'
become: yes
- name: Enable and start containerd
ansible.builtin.systemd:
name: containerd
state: restarted
enabled: true
become: yes