From 0dfc026596fbc7cb5d0c73a884b424b523dca7e4 Mon Sep 17 00:00:00 2001
From: Ondřej Ezr <oezr@redhat.com>
Date: Wed, 11 Mar 2020 00:13:36 +0100
Subject: [PATCH] Satellite role - create organization through foreman-ansible-modules (#1289)

---
 ansible/install_galaxy_roles.yml |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ansible/install_galaxy_roles.yml b/ansible/install_galaxy_roles.yml
index e705357..f0f393e 100644
--- a/ansible/install_galaxy_roles.yml
+++ b/ansible/install_galaxy_roles.yml
@@ -26,6 +26,20 @@
         ansible-galaxy install
         -r "{{ requirements_path }}"
         -p "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/roles"
-      when:
-        - r_requirements_stat.stat.exists
-        - r_requirements_content | length > 0
+      when: >-
+        r_requirements_stat.stat.exists
+        and r_requirements_content | length > 0
+        and ( r_requirements_content is mapping
+              and 'roles' in r_requirements_content )
+        or r_requirements_contet is sequence
+
+    - name: Import collections from requirements.yml
+      command: >-
+        ansible-galaxy collection install
+        -r "{{ requirements_path }}"
+        -p "configs/{{ env_type }}/collections"
+      when: >-
+        r_requirements_stat.stat.exists
+        and r_requirements_content | length > 0
+        and r_requirements_content is mapping
+        and "collections" in r_requirements_content

--
Gitblit v1.9.3