From f224cb6fe736646e8941b2d3cb76038fc6177a5c Mon Sep 17 00:00:00 2001 From: Tom Doel Date: Thu, 22 Aug 2024 11:06:36 +0100 Subject: [PATCH] Adds yum-version lock to prevent docker from upgrading if a version is specified (#132) Prevents automated yum updates from upgrading docker if pinned to a specific version --- roles/docker/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index e0a07958..0dfe0816 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -43,6 +43,18 @@ - docker-buildx-plugin - docker-compose-plugin +- name: Ensure yum-plugin-versionlock is installed + ansible.builtin.yum: + name: yum-plugin-versionlock + state: installed + +- name: Prevent docker from being updated + community.general.yum_versionlock: + state: "{{ 'absent' if docker_version == 'latest' else 'present' }}" + name: + - docker-ce + - docker-ce-cli + - name: Ensure docker service directory exists ansible.builtin.file: path: "{{ docker_service_directory }}"