Allow full path to be specified for amphora destination

Different versions of TripleO have different restrictions for the
amphora location. Parameterizing it allows quickstart and the
templates to put it in suitable locations.

Change-Id: I61c2e69f34280304c9dbab7af5e597956e5a7efe
This commit is contained in:
Brent Eagles 2019-11-04 13:53:31 -03:30
parent e1bfeb1fd3
commit 543343d450
5 changed files with 32 additions and 4 deletions

View File

@ -96,3 +96,11 @@ baremetal_provision: false
# If `undercloud_enable_nova` is `true`, the undercloud will have running glance and nova services
undercloud_enable_nova: true
# Set the location for the downloaded amphora image when download_amphora is true
octavia_amphora_path: >-
{% if release in ['queens', 'rocky'] -%}
/usr/share/openstack-octavia-amphora-images/amphora-x64-haproxy.qcow2
{%- else -%}
{{ working_dir }}/amphora.qcow2
{%- endif %}

View File

@ -11,7 +11,7 @@ This playbook expects a supported version of Ansible and working Internet access
Role Variables:
---------------
- target\_dir <'$HOME'> -- location to store the downloaded image
- octavia_amphora_path -- full path for the downloaded amphora image.
- amphora\_url -- url of image to download. If not provided a default location based on branch is used.
Dependenncies

View File

@ -1,2 +0,0 @@
---
target_dir: "{{ working_dir }}"

View File

@ -0,0 +1,3 @@
---
dependencies:
- extras-common

View File

@ -11,7 +11,26 @@
when:
download_url is not defined
- name: check for target directory for amphora image
stat:
path: "{{ octavia_amphora_path | dirname }}"
register: amphora_path_stat_result
# We check for an existing directory because we do not want to modify
# permissions on existing directories, potentially causing perm issues
# with other tasks/processes.
- name: If target path does not exist, create as readable to everyone.
file:
path: "{{ octavia_amphora_path | dirname }}"
state: directory
mode: 0755
become: true
when:
- not amphora_path_stat_result.stat.exists|bool
- name: Download the amphora
get_url:
url: "{{ download_url }}"
dest: "{{ target_dir }}/amphora.qcow2"
dest: "{{ octavia_amphora_path }}"
mode: 0644
become: true