From 7662f4a11fb84da7ba7ddc02f7779c74a5f2a9df Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 31 Oct 2022 02:25:47 +1300 Subject: [PATCH] begin k8s config --- ansible/playbooks/04_k8s.yaml | 2 +- ansible/roles/k8s_control/tasks/main.yaml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) 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