From e64b83c619cb4a67ec3145c09099287ec071f044 Mon Sep 17 00:00:00 2001 From: JesusMtnez Date: Sat, 13 Jan 2024 07:36:32 +0100 Subject: [PATCH] feat(ansible): move docker setup to tasks --- ansible/playbooks/k3s-bootstrap.yml | 17 ++--------------- ansible/playbooks/tasks/docker.yml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 ansible/playbooks/tasks/docker.yml diff --git a/ansible/playbooks/k3s-bootstrap.yml b/ansible/playbooks/k3s-bootstrap.yml index 02b2ee6..ce9082e 100644 --- a/ansible/playbooks/k3s-bootstrap.yml +++ b/ansible/playbooks/k3s-bootstrap.yml @@ -27,21 +27,8 @@ backrefs: true when: check_cgroups.found == 0 - - name: Setup containerd - block: - - name: Check if containerd (docker) is installed - ansible.builtin.lineinfile: - path: /boot/dietpi/.installed - line: "aSOFTWARE_INSTALL_STATE[162]=2" - state: absent - check_mode: true - changed_when: false - register: prereq_docker - - - name: Install containerd (docker) # noqa no-handler no-changed-when - ansible.builtin.command: - cmd: /boot/dietpi/dietpi-software install 162 - when: not prereq_docker.found + - name: Setup docker + ansible.builtin.include_tasks: ./tasks/docker.yml - name: Setup nfs ansible.builtin.package: diff --git a/ansible/playbooks/tasks/docker.yml b/ansible/playbooks/tasks/docker.yml new file mode 100644 index 0000000..d8cf451 --- /dev/null +++ b/ansible/playbooks/tasks/docker.yml @@ -0,0 +1,16 @@ +--- +- name: Docker + block: + - name: Docker | check if docker is installed + ansible.builtin.lineinfile: + path: /boot/dietpi/.installed + line: "aSOFTWARE_INSTALL_STATE[162]=2" + state: absent + check_mode: true + changed_when: false + register: check_docker + + - name: Docker | install docker # noqa no-handler no-changed-when + ansible.builtin.command: + cmd: /boot/dietpi/dietpi-software install 162 + when: not check_docker.found