forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_galaxy_roles.yml
51 lines (47 loc) · 1.65 KB
/
install_galaxy_roles.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- name: Step 0000 - Install Galaxy roles
hosts: localhost
connection: local
gather_facts: false
become: false
vars:
# User can override this variable to specify a different requirements.yml, like:
# -e requirements_path=.../requirements_prod.yml
## PS: ROLE_IMPROVE_TASK
## Needs to be validated
## var is called from main.yml
requirements_path: "configs/{{ env_type }}/requirements.yml"
tasks:
- name: Check if requirements.yml exists
stat:
path: "{{ requirements_path }}"
register: r_requirements_stat
- set_fact:
r_requirements_content: "{{ lookup('file', requirements_path) | from_yaml }}"
when: r_requirements_stat.stat.exists
- name: Import roles from requirements.yml
command: >-
ansible-galaxy install
-r "{{ requirements_path }}"
-p "{{ ANSIBLE_REPO_PATH | default('.') }}/configs/{{ env_type }}/roles"
when: >-
r_requirements_stat.stat.exists
and r_requirements_content | length > 0
and (r_requirements_content is sequence
or (r_requirements_content is mapping
and 'roles' in r_requirements_content)
)
- name: Import collections from requirements.yml
command: >-
ansible-galaxy collection install
-r "{{ requirements_path }}"
-p collections
--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
- name: Install dynamic sources
include_role:
name: agnosticd_dynamic