Merge "Allow full path to be specified for amphora destination"

This commit is contained in:
Zuul 2020-03-16 21:28:51 +00:00 committed by Gerrit Code Review
commit 7664c3f7a6
5 changed files with 32 additions and 4 deletions
roles
extras-common/defaults
octavia-amphora-download

@ -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 %}

@ -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

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

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

@ -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