From c2700266b084e5d2939611db302ac8182dfce2b1 Mon Sep 17 00:00:00 2001
From: Calin Cristian Andrei <cristian.calin@outlook.com>
Date: Thu, 9 Jun 2022 16:54:33 +0300
Subject: [PATCH] [download] fix dependencies for downloads

---
 roles/container-engine/cri-o/meta/main.yml     |  3 +++
 roles/container-engine/crictl/tasks/crictl.yml |  4 ----
 roles/container-engine/crictl/tasks/main.yml   |  1 -
 roles/download/tasks/download_file.yml         |  5 ++++-
 roles/download/tasks/main.yml                  | 14 --------------
 5 files changed, 7 insertions(+), 20 deletions(-)
 create mode 100644 roles/container-engine/cri-o/meta/main.yml

diff --git a/roles/container-engine/cri-o/meta/main.yml b/roles/container-engine/cri-o/meta/main.yml
new file mode 100644
index 000000000..ec9d9a55e
--- /dev/null
+++ b/roles/container-engine/cri-o/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+  - role: container-engine/crictl
diff --git a/roles/container-engine/crictl/tasks/crictl.yml b/roles/container-engine/crictl/tasks/crictl.yml
index 134c054b2..36e09e4a8 100644
--- a/roles/container-engine/crictl/tasks/crictl.yml
+++ b/roles/container-engine/crictl/tasks/crictl.yml
@@ -20,7 +20,3 @@
   notify:
     - Get crictl completion
     - Install crictl completion
-
-- name: Set fact crictl_installed
-  set_fact:
-    crictl_installed: true
diff --git a/roles/container-engine/crictl/tasks/main.yml b/roles/container-engine/crictl/tasks/main.yml
index 30f1004c2..99ed216cd 100644
--- a/roles/container-engine/crictl/tasks/main.yml
+++ b/roles/container-engine/crictl/tasks/main.yml
@@ -1,4 +1,3 @@
 ---
 - name: install crictĺ
   include_tasks: crictl.yml
-  when: not crictl_installed | default(false)
diff --git a/roles/download/tasks/download_file.yml b/roles/download/tasks/download_file.yml
index 2e054eff5..b6d3ad1b6 100644
--- a/roles/download/tasks/download_file.yml
+++ b/roles/download/tasks/download_file.yml
@@ -1,5 +1,9 @@
 ---
 - block:
+  - name: prep_download | Set a few facts
+    set_fact:
+      download_force_cache: "{{ true if download_run_once else download_force_cache }}"
+
   - name: download_file | Starting download of file
     debug:
       msg: "{{ download.url }}"
@@ -31,7 +35,6 @@
     become: false
     when:
     - download_force_cache
-    - download_localhost
     tags:
     - localhost
 
diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml
index 94e9d03aa..536c293a7 100644
--- a/roles/download/tasks/main.yml
+++ b/roles/download/tasks/main.yml
@@ -7,20 +7,6 @@
     - download
     - upload
 
-- name: install crictl
-  import_role:
-    name: container-engine/crictl
-  when:
-    - not skip_downloads|default(false)
-    - container_manager in ['containerd', 'crio']
-
-- name: install nerdctl
-  import_role:
-    name: container-engine/nerdctl
-  when:
-    - not skip_downloads|default(false)
-    - container_manager in ['containerd']
-
 - name: download | Get kubeadm binary and list of required images
   include_tasks: prep_kubeadm_images.yml
   when:
-- 
GitLab