From 7bf601111100fe2b34541f9211b7e96c0007d48f Mon Sep 17 00:00:00 2001 From: Dimitri Koshkin Date: Thu, 31 Aug 2023 12:48:40 -0700 Subject: [PATCH] fix: don't override Docker systemd unit file for Flatcar (#896) Don't revert Docker and Containerd systemd unit files when running KIB for a second time after downloading a new version of Docker. --- .../containerd/tasks/install-flatcar.yaml | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ansible/roles/containerd/tasks/install-flatcar.yaml b/ansible/roles/containerd/tasks/install-flatcar.yaml index 45ac5c955..b589d6018 100644 --- a/ansible/roles/containerd/tasks/install-flatcar.yaml +++ b/ansible/roles/containerd/tasks/install-flatcar.yaml @@ -15,15 +15,7 @@ - ansible_facts['distribution_version'] is version('3033.3.0', '>=', version_type='semver') - ansible_facts['distribution_version'] is version('3033.4.0', '<', version_type='semver') -- name: Create systemd unit file for containerd - template: - dest: /etc/systemd/system/containerd.service - src: etc/systemd/system/containerd-flatcar.service - mode: 0600 - when: dockerUpgradeRequired is not defined - -- name: Download, Update and Restart docker for 3033.3.x flatcar LTS - when: dockerUpgradeRequired is true +- when: dockerUpgradeRequired is true block: - name: Download docker for 3033.3.x flatcar LTS to /opt/docker.tgz get_url: @@ -48,6 +40,20 @@ - docker - containerd +- name: Check if /opt/bin/dockerd binary exists + changed_when: false + stat: + path: "/opt/bin/dockerd" + register: dockerd_binary_exists + +# Only run this task if not using the downloaded Docker binary +- name: Create systemd unit file for containerd + template: + dest: /etc/systemd/system/containerd.service + src: etc/systemd/system/containerd-flatcar.service + mode: 0600 + when: not dockerd_binary_exists.stat.exists + - name: Create containerd memory pressure drop in file template: dest: /etc/systemd/system/containerd.service.d/memory-pressure.conf