forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_galaxy_roles.yml
31 lines (29 loc) · 1.01 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
---
- 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
- r_requirements_content | length > 0