Allow role path override in fetch play
Allow a var override to the default role destination path when none is specified for the role in the requirements file. Change-Id: Ib063db808eabae4bfd3e6016e83ec5347b478185
This commit is contained in:
parent
b70a0276f4
commit
f34df8320d
@ -20,8 +20,8 @@
|
||||
tasks:
|
||||
- name: Remove target directory if required
|
||||
shell: |
|
||||
if [[ ! -d "{{ item.path | default('/etc/ansible/roles') }}/{{ item.name | default(item.src | basename) }}/.git" ]]; then
|
||||
rm -rf "{{ item.path | default('/etc/ansible/roles') }}/{{ item.name | default(item.src | basename) }}"
|
||||
if [[ ! -d "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}/.git" ]]; then
|
||||
rm -rf "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}"
|
||||
fi
|
||||
args:
|
||||
executable: /bin/bash
|
||||
@ -31,7 +31,7 @@
|
||||
- name: Clone git repos
|
||||
git:
|
||||
repo: "{{ item.src }}"
|
||||
dest: "{{ item.path | default('/etc/ansible/roles') }}/{{ item.name | default(item.src | basename) }}"
|
||||
dest: "{{ item.path | default(role_path_default) }}/{{ item.name | default(item.src | basename) }}"
|
||||
version: "{{ item.version | default('master') }}"
|
||||
update: true
|
||||
force: true
|
||||
@ -40,4 +40,5 @@
|
||||
with_items: "{{ roles }}"
|
||||
vars:
|
||||
roles: "{{ lookup('file', role_file) | from_yaml }}"
|
||||
role_file: '../ansible-role-requirements.yml'
|
||||
role_file: '../ansible-role-requirements.yml'
|
||||
role_path_default: '/etc/ansible/roles'
|
||||
|
Loading…
Reference in New Issue
Block a user