From f34df8320db3a87728e5d6eafec34a558df35957 Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 9 Nov 2016 22:15:54 -0600 Subject: [PATCH] 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 --- tests/get-ansible-role-requirements.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/get-ansible-role-requirements.yml b/tests/get-ansible-role-requirements.yml index fe81dac920..d30b9fc7bb 100644 --- a/tests/get-ansible-role-requirements.yml +++ b/tests/get-ansible-role-requirements.yml @@ -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' \ No newline at end of file + role_file: '../ansible-role-requirements.yml' + role_path_default: '/etc/ansible/roles'