Skip to content

Commit

Permalink
Fix to install collections into collections paths (#4383)
Browse files Browse the repository at this point in the history
* Fix to install collections into collections temporary paths

* Add retries for ansible-galaxy commands
  • Loading branch information
jkupferer committed Feb 21, 2022
1 parent cb27c1e commit eab1690
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ansible/install_galaxy_roles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
r_requirements_content: "{{ lookup('file', requirements_path) | from_yaml }}"
when: r_requirements_stat.stat.exists

- name: Import roles from requirements.yml
- name: Install roles from requirements.yml
command: >-
ansible-galaxy install
-r "{{ requirements_path }}"
Expand All @@ -33,18 +33,29 @@
or (r_requirements_content is mapping
and 'roles' in r_requirements_content)
)
register: r_ansible_galaxy_install_roles
until: r_ansible_galaxy_install_roles is successful
retries: 10
delay: 30

- name: Import collections from requirements.yml
- name: Install collections from requirements.yml
vars:
__collections_path: "{{ lookup('config', 'COLLECTIONS_PATHS')[0] }}"
command: >-
ansible-galaxy collection install
-r "{{ requirements_path }}"
-p collections
-p "{{ __collections_path | quote }}"
--force-with-deps
when: >-
r_requirements_stat.stat.exists
and r_requirements_content | length > 0
and r_requirements_content is mapping
and "collections" in r_requirements_content
and __collections_path.startswith('/tmp/')
register: r_ansible_galaxy_install_collections
until: r_ansible_galaxy_install_collections is successful
retries: 10
delay: 30

- name: Install dynamic sources
include_role:
Expand Down

0 comments on commit eab1690

Please sign in to comment.