mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
fix project_update role/collection install
- avoid looping - avoid using multiple files, only one should be provided and processed per type - use first_found and variables to locate existing file - skip if no file exists
This commit is contained in:
@@ -216,13 +216,15 @@
|
|||||||
- block:
|
- block:
|
||||||
- name: Fetch galaxy roles from roles/requirements.(yml/yaml)
|
- name: Fetch galaxy roles from roles/requirements.(yml/yaml)
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "ansible-galaxy role install -r {{ item }} {{ verbosity }}"
|
cmd: "ansible-galaxy role install -r {{ req_file }} {{ verbosity }}"
|
||||||
register: galaxy_result
|
register: galaxy_result
|
||||||
with_fileglob:
|
vars:
|
||||||
- "{{ project_path | quote }}/roles/requirements.yaml"
|
req_file: "{{ req_candidates | first_found }}"
|
||||||
- "{{ project_path | quote }}/roles/requirements.yml"
|
req_candidates:
|
||||||
|
- "{{ project_path | quote }}/roles/requirements.yml"
|
||||||
|
- "{{ project_path | quote }}/roles/requirements.yaml"
|
||||||
changed_when: "'was installed successfully' in galaxy_result.stdout"
|
changed_when: "'was installed successfully' in galaxy_result.stdout"
|
||||||
when: roles_enabled | bool
|
when: roles_enabled | bool and req_file is file
|
||||||
tags:
|
tags:
|
||||||
- install_roles
|
- install_roles
|
||||||
|
|
||||||
@@ -230,28 +232,36 @@
|
|||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "ansible-galaxy collection install -r {{ item }} {{ verbosity }}"
|
cmd: "ansible-galaxy collection install -r {{ item }} {{ verbosity }}"
|
||||||
register: galaxy_collection_result
|
register: galaxy_collection_result
|
||||||
with_fileglob:
|
vars:
|
||||||
- "{{ project_path | quote }}/collections/requirements.yaml"
|
req_file: "{{ req_candidates | first_found }}"
|
||||||
- "{{ project_path | quote }}/collections/requirements.yml"
|
req_candidates:
|
||||||
|
- "{{ project_path | quote }}/collections/requirements.yml"
|
||||||
|
- "{{ project_path | quote }}/collections/requirements.yaml"
|
||||||
|
- "{{ project_path | quote }}/requirements.yml"
|
||||||
|
- "{{ project_path | quote }}/requirements.yaml"
|
||||||
changed_when: "'Nothing to do.' not in galaxy_collection_result.stdout"
|
changed_when: "'Nothing to do.' not in galaxy_collection_result.stdout"
|
||||||
when:
|
when:
|
||||||
- "ansible_version.full is version_compare('2.9', '>=')"
|
- "ansible_version.full is version_compare('2.9', '>=')"
|
||||||
- collections_enabled | bool
|
- collections_enabled | bool
|
||||||
|
- req_file is file
|
||||||
tags:
|
tags:
|
||||||
- install_collections
|
- install_collections
|
||||||
|
|
||||||
- name: Fetch galaxy roles and collections from requirements.(yml/yaml)
|
- name: Fetch galaxy roles and collections from requirements.(yml/yaml)
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "ansible-galaxy install -r {{ item }} {{ verbosity }}"
|
cmd: "ansible-galaxy install -r {{ req_file }} {{ verbosity }}"
|
||||||
register: galaxy_combined_result
|
register: galaxy_combined_result
|
||||||
with_fileglob:
|
vars:
|
||||||
- "{{ project_path | quote }}/requirements.yaml"
|
req_file: "{{ req_candidates | first_found }}"
|
||||||
- "{{ project_path | quote }}/requirements.yml"
|
req_candidates:
|
||||||
|
- "{{ project_path | quote }}/requirements.yaml"
|
||||||
|
- "{{ project_path | quote }}/requirements.yml"
|
||||||
changed_when: "'Nothing to do.' not in galaxy_combined_result.stdout"
|
changed_when: "'Nothing to do.' not in galaxy_combined_result.stdout"
|
||||||
when:
|
when:
|
||||||
- "ansible_version.full is version_compare('2.10', '>=')"
|
- "ansible_version.full is version_compare('2.10', '>=')"
|
||||||
- collections_enabled | bool
|
- collections_enabled | bool
|
||||||
- roles_enabled | bool
|
- roles_enabled | bool
|
||||||
|
- req_file is file
|
||||||
tags:
|
tags:
|
||||||
- install_collections
|
- install_collections
|
||||||
- install_roles
|
- install_roles
|
||||||
|
|||||||
Reference in New Issue
Block a user