From 3dc384a17a661c9906a41fed033c4078d2c0ff17 Mon Sep 17 00:00:00 2001
From: Chad Swenson <chadswen@gmail.com>
Date: Thu, 8 Dec 2022 17:58:18 -0600
Subject: [PATCH] Allow `containerd-common` to execute multiple times per play
 (#9543)

The `containerd-common` role is responsible for gathering OS specific variables from the vars directory of the roles that include or import it. `containerd-common` is imported via role dependency by a total of two roles, `container-engine/docker`, and `container-engine/containerd`.

containerd-common is needed by both the docker and containerd roles as a dependency when:
- containerd is selected as the container engine
- a docker install is detected and needs to be removed
- apt is the package manager

However, by default, roles can not be invoked more than once in the same play, unless `allow_duplicates: true` is set for that role. This results in the failure of the `containerd | Remove containerd repository` task, since only the docker vars will be loaded in the play, and `containerd_repo_info.repos`, normally populated by containerd/vars, is left empty.

This change sets `allow_duplicates: true` for `containerd-common` which fixes the currently failing containerd tasks if docker was detected and removed in the same play.
---
 roles/container-engine/containerd-common/meta/main.yml | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 roles/container-engine/containerd-common/meta/main.yml

diff --git a/roles/container-engine/containerd-common/meta/main.yml b/roles/container-engine/containerd-common/meta/main.yml
new file mode 100644
index 000000000..a4159c5bf
--- /dev/null
+++ b/roles/container-engine/containerd-common/meta/main.yml
@@ -0,0 +1,2 @@
+---
+allow_duplicates: true
\ No newline at end of file
-- 
GitLab