Prevent bootstrap failure when all roles/collections are overriden

At the moment we assume that scenario when all roles or collections
provided by ansible-role/collection-requirements won't be overwritten.
As if they do, previous set_fact will be skipped and
galaxy_collections_list/clone_roles will remain undefined.

To avoid failure and to allow to fully override roles/collections we
define default for the task that aims to merge default items with
user-provided ones.

Change-Id: I86d44499073f0571a529d81ed3be713996e5f339
This commit is contained in:
Dmitriy Rabotyagov 2022-12-21 13:41:10 +01:00 committed by Dmitriy Rabotyagov
parent bdfa671030
commit 63363abdbf
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@
- name: Append user collections to filtered required collections - name: Append user collections to filtered required collections
set_fact: set_fact:
galaxy_collections_list: "{{ galaxy_collections_list + [ item ] }}" galaxy_collections_list: "{{ (galaxy_collections_list | default([])) + [ item ] }}"
with_items: "{{ user_collections.collections }}" with_items: "{{ user_collections.collections }}"
when: when:
- user_collections.collections is defined - user_collections.collections is defined

View File

@ -132,7 +132,7 @@
- name: Append user overridden roles - name: Append user overridden roles
set_fact: set_fact:
clone_roles: "{{ clone_roles + user_roles }}" clone_roles: "{{ (clone_roles | default([])) + user_roles }}"
- name: Clone git repos - name: Clone git repos
block: block: