From 032341c7fc06a37b2fac9904a63483b89122c799 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 19 Apr 2021 15:45:51 -0400 Subject: [PATCH 1/2] Move to fileglob loop for yml requirement locations --- awx/playbooks/project_update.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml index 092cfd0467d8..796e90d36657 100644 --- a/awx/playbooks/project_update.yml +++ b/awx/playbooks/project_update.yml @@ -161,22 +161,17 @@ tasks: - block: - - name: detect roles/requirements.(yml/yaml) - stat: - path: "{{project_path|quote}}/roles/requirements{{ item.ext }}" - with_items: "{{ yaml_exts }}" - register: doesRequirementsExist - - name: fetch galaxy roles from requirements.(yml/yaml) command: > - ansible-galaxy role install -r {{ item.stat.path }} + ansible-galaxy role install -r {{ item }} --roles-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_roles {{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }} args: chdir: "{{project_path|quote}}" register: galaxy_result - with_items: "{{ doesRequirementsExist.results }}" - when: item.stat.exists + with_fileglob: + - "{{project_path|quote}}/roles/requirements.yaml" + - "{{project_path|quote}}/roles/requirements.yml" changed_when: "'was installed successfully' in galaxy_result.stdout" environment: ANSIBLE_FORCE_COLOR: false @@ -187,22 +182,19 @@ - install_roles - block: - - name: detect collections/requirements.(yml/yaml) - stat: - path: "{{project_path|quote}}/collections/requirements{{ item.ext }}" - with_items: "{{ yaml_exts }}" - register: doesCollectionRequirementsExist - - name: fetch galaxy collections from collections/requirements.(yml/yaml) command: > - ansible-galaxy collection install -r {{ item.stat.path }} + ansible-galaxy collection install -r {{ item }} --collections-path {{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_collections {{ ' -' + 'v' * ansible_verbosity if ansible_verbosity else '' }} args: chdir: "{{project_path|quote}}" register: galaxy_collection_result - with_items: "{{ doesCollectionRequirementsExist.results }}" - when: item.stat.exists + with_fileglob: + - "{{project_path|quote}}/collections/requirements.yaml" + - "{{project_path|quote}}/collections/requirements.yml" + - "{{project_path|quote}}/requirements.yaml" + - "{{project_path|quote}}/requirements.yml" changed_when: "'Installing ' in galaxy_collection_result.stdout" environment: ANSIBLE_FORCE_COLOR: false From 27d56726a3b5e4037a414f9d438ffa56e4eb50de Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 19 Apr 2021 15:55:29 -0400 Subject: [PATCH 2/2] Remove yaml_exts play variable --- awx/playbooks/project_update.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml index 796e90d36657..bf3ee934a891 100644 --- a/awx/playbooks/project_update.yml +++ b/awx/playbooks/project_update.yml @@ -154,10 +154,6 @@ gather_facts: false connection: local name: Install content with ansible-galaxy command if necessary - vars: - yaml_exts: - - {ext: .yml} - - {ext: .yaml} tasks: - block: