From 9010a3e93702259d2b66ddfbf631c8b2f47ec258 Mon Sep 17 00:00:00 2001 From: Ramon Perez Date: Tue, 17 Oct 2023 18:21:24 +0200 Subject: [PATCH] populate_mirror_registry | Ensure pullsecret is placed in config_file_path --- .../tasks/prerequisites.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/roles/populate_mirror_registry/tasks/prerequisites.yml b/roles/populate_mirror_registry/tasks/prerequisites.yml index 4cefcd54..00f89823 100644 --- a/roles/populate_mirror_registry/tasks/prerequisites.yml +++ b/roles/populate_mirror_registry/tasks/prerequisites.yml @@ -17,6 +17,23 @@ state: present become: true +# The pullsecret is copied in config_file_path in setup_mirror_registry, and this copy can +# be modified in that role. This role is usually executed prior to populate_mirror_registry, +# so we need to check if the pullsecret is present there or not. +- name: "Check if {{ pull_secret_file_name }} has already been copied in {{ config_file_path }}" + stat: + path: "{{ config_file_path }}/{{ pull_secret_file_name }}" + register: copied_pull_secret + +# If not present, let's copy it for the next tasks that require it. +- name: Copy pull_secret + copy: + src: "{{ local_pull_secret_path }}" + dest: "{{ config_file_path }}/{{ pull_secret_file_name }}" + mode: 0644 + when: + - not copied_pull_secret.stat.exists + - name: Create download dirs ansible.builtin.file: path: "{{ item }}"