Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability of installing roles by reading several requirements.yml files placed on subdirectories inside of roles/ #3887

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions awx/playbooks/project_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,28 @@

- block:
- name: detect requirements.yml
stat: path={{project_path|quote}}/roles/requirements.yml
find:
path: "{{project_path|quote}}/roles/"
file_type: file
patterns: 'requirements.yml'
recurse: true
register: doesRequirementsExist

- name: fetch galaxy roles from requirements.yml
command: ansible-galaxy install -r requirements.yml -p {{project_path|quote}}/roles/
args:
chdir: "{{project_path|quote}}/roles"
command: "ansible-galaxy install -r {{item.path}} -p {{item.path|dirname}}"
register: galaxy_result
when: doesRequirementsExist.stat.exists and (scm_version is undefined or (git_result is defined and git_result['before'] == git_result['after']))
loop: "{{doesRequirementsExist.files}}"
loop_control:
label: "{{item.path}}"
when: item.path is defined and (scm_version is undefined or (git_result is defined and git_result['before'] == git_result['after']))
changed_when: "'was installed successfully' in galaxy_result.stdout"

- name: fetch galaxy roles from requirements.yml (forced update)
command: ansible-galaxy install -r requirements.yml -p {{project_path|quote}}/roles/ --force
args:
chdir: "{{project_path|quote}}/roles"
when: doesRequirementsExist.stat.exists and galaxy_result is skipped
command: "ansible-galaxy install -r {{item.path}} -p {{item.path|dirname}} --force"
loop: "{{doesRequirementsExist.files}}"
loop_control:
label: "{{item.path}}"
when: item.path is defined and galaxy_result is skipped

when: roles_enabled|bool
delegate_to: localhost