diff --git a/ansible/playbooks/04_k8s.yaml b/ansible/playbooks/04_k8s.yaml index 7994a84..982ed9a 100644 --- a/ansible/playbooks/04_k8s.yaml +++ b/ansible/playbooks/04_k8s.yaml @@ -2,6 +2,6 @@ - name: configure control plane hosts: k8s_control gather_facts: true - become: false + become: true roles: - k8s_control diff --git a/ansible/roles/k8s_control/tasks/main.yaml b/ansible/roles/k8s_control/tasks/main.yaml index ed97d53..c06feb2 100644 --- a/ansible/roles/k8s_control/tasks/main.yaml +++ b/ansible/roles/k8s_control/tasks/main.yaml @@ -1 +1,22 @@ --- +- name: create containerd config dir + ansible.builtin.file: + path: /etc/containerd + state: directory + owner: root + group: root + mode: 0664 + +- name: create containerd default config + ansible.builtin.shell: + cmd: | + containerd config default > /etc/containerd/config.toml + creates: /etc/containerd/config.toml + +- name: enable systemd cgroups in containerd config + ansible.builtin.lineinfile: + path: /etc/containerd/config.toml + regexp: '^(.*)SystemdCgroup = false$' + line: ' SystemdCgroup = true' + backrefs: true + state: present \ No newline at end of file