Add default value for user_role_file when cloning git repos

This change allows scripts/get-ansible-role-requirements.yml playbook
to be used as a standalone tool for cloning all OSA repos
referenced in ansible-role-requirements.yml into a user defined workspace.
This is useful for automatically bootstrapping a development environment
with all of the OSA ansible roles cloned outside /etc/ansible/roles.

Example:

ansible-playbook scripts/get-ansible-role-requirements.yml -e role_path_default=/path/to/workspace

Change-Id: I207853206435f0ec5faca95c69c25230e0c6b50c
This commit is contained in:
Jonathan Rosser 2020-03-26 12:21:20 +00:00
parent 49cc6c656c
commit f05af2d772

View File

@ -17,6 +17,7 @@
hosts: localhost
connection: local
user: root
gather_facts: false
tasks:
- name: Remove target directory if required
file:
@ -135,6 +136,6 @@
role_file: "{{ playbook_dir }}/../ansible-role-requirements.yml"
role_path_default: '/etc/ansible/roles'
user_roles: "{{ lookup('file', user_role_path, errors='ignore')|default([], true) | from_yaml }}"
user_role_path: "{{ lookup('env', 'OSA_CONFIG_DIR')|default('/etc/openstack_deploy') ~ '/' ~ user_role_file }}"
user_role_path: "{{ lookup('env', 'OSA_CONFIG_DIR')|default('/etc/openstack_deploy') ~ '/' ~ (user_role_file|default('')) }}"
git_clone_retries: 2
git_clone_retry_delay: 5