From 4612cf32f114801780bd1078e358bfe51179fc86 Mon Sep 17 00:00:00 2001 From: Brent Eagles Date: Fri, 28 Jun 2019 12:23:10 -0230 Subject: [PATCH] Add a tasks to download amphora image for octavia deployments This patch adds a task to download the Octavia Amphora image to the working directory on the undercloud so that it can be pulled in by the Octavia overcloud deployment tasks. Change-Id: Ie387f1274059ec80d19c5ef0bf9aed7a3a999e2a --- playbooks/baremetal-full-undercloud.yml | 9 ++++ playbooks/multinode-standalone.yml | 9 ++++ playbooks/multinode-undercloud.yml | 9 ++++ playbooks/quickstart-extras-undercloud.yml | 9 ++++ roles/octavia-amphora-download/README.md | 43 +++++++++++++++++++ .../defaults/main.yml | 2 + roles/octavia-amphora-download/tasks/main.yml | 17 ++++++++ 7 files changed, 98 insertions(+) create mode 100644 roles/octavia-amphora-download/README.md create mode 100644 roles/octavia-amphora-download/defaults/main.yml create mode 100644 roles/octavia-amphora-download/tasks/main.yml diff --git a/playbooks/baremetal-full-undercloud.yml b/playbooks/baremetal-full-undercloud.yml index b75c0fead..44117500f 100644 --- a/playbooks/baremetal-full-undercloud.yml +++ b/playbooks/baremetal-full-undercloud.yml @@ -26,6 +26,15 @@ tags: - validate-undercloud +- name: Download amphora image for octavia + hosts: undercloud + gather_facts: false + tags: + - octavia + roles: + - {role: octavia-amphora-download, + when: download_amphora is defined and download_amphora|bool} + - name: Build images for quickstart hosts: undercloud gather_facts: false diff --git a/playbooks/multinode-standalone.yml b/playbooks/multinode-standalone.yml index e64ed3305..fb357bf91 100644 --- a/playbooks/multinode-standalone.yml +++ b/playbooks/multinode-standalone.yml @@ -26,6 +26,15 @@ tags: - build +- name: Download amphora image for octavia + hosts: undercloud + gather_facts: false + roles: + - {role: octavia-amphora-download, + when: download_amphora is defined and download_amphora|bool} + tags: + - octavia + # NOTE(aschultz): nested virt causes problems in CI so we default to qemu # and do not do the dynamic virt lookup. - name: Deploy Standalone diff --git a/playbooks/multinode-undercloud.yml b/playbooks/multinode-undercloud.yml index 61519de39..982671b10 100644 --- a/playbooks/multinode-undercloud.yml +++ b/playbooks/multinode-undercloud.yml @@ -85,6 +85,15 @@ roles: - validate-undercloud +- name: Download amphora image for octavia + hosts: undercloud + gather_facts: false + tags: + - octavia + roles: + - {role: octavia-amphora-download, + when: download_amphora is defined and download_amphora|bool} + - name: Set Libvirt type hosts: overcloud roles: diff --git a/playbooks/quickstart-extras-undercloud.yml b/playbooks/quickstart-extras-undercloud.yml index 47e5c7a93..05d9a77be 100644 --- a/playbooks/quickstart-extras-undercloud.yml +++ b/playbooks/quickstart-extras-undercloud.yml @@ -38,3 +38,12 @@ roles: - {role: tripleo-validations, when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} + +- name: Download amphora image for octavia + hosts: undercloud + gather_facts: false + tags: + - octavia + roles: + - {role: octavia-amphora-download, + when: download_amphora is defined and download_amphora|bool} diff --git a/roles/octavia-amphora-download/README.md b/roles/octavia-amphora-download/README.md new file mode 100644 index 000000000..51b8246df --- /dev/null +++ b/roles/octavia-amphora-download/README.md @@ -0,0 +1,43 @@ +Octavia-amphora-download +======================== + +An Ansible role to download Octavia amphora images to be used in CI or scripted deployments. + +Requirements +------------ + +This playbook expects a supported version of Ansible and working Internet access. + +Role Variables: +--------------- + +- target\_dir <'$HOME'> -- location to store the downloaded image +- amphora\_url -- url of image to download. If not provided a default location based on branch is used. + +Dependenncies +------------- + +No dependencies + +Example Playbook +---------------- + +Download the amphora image for the stein branch to foo's home directory: + + - hosts: undercloud + vars: + release: "stein" + target_dir: "/home/foo" + roles: + - octavia-amphora-dowload + + +License +------- + +Apache 2.0 + +Author Information +------------------ + +RDO-CI Team diff --git a/roles/octavia-amphora-download/defaults/main.yml b/roles/octavia-amphora-download/defaults/main.yml new file mode 100644 index 000000000..7bd84ddf2 --- /dev/null +++ b/roles/octavia-amphora-download/defaults/main.yml @@ -0,0 +1,2 @@ +--- +target_dir: "{{ working_dir }}" diff --git a/roles/octavia-amphora-download/tasks/main.yml b/roles/octavia-amphora-download/tasks/main.yml new file mode 100644 index 000000000..ea076a140 --- /dev/null +++ b/roles/octavia-amphora-download/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: Set the download url if amphora_url provided + set_fact: + download_url: "{{ amphora_url }}" + when: + amphora_url is defined and ((amphora_url | length) > 0) + +- name: Set the download url to specified release branch if amphora_url not provided + set_fact: + download_url: "https://images.rdoproject.org/octavia/{{ release }}/amphora-x64-haproxy-centos.qcow2" + when: + download_url is not defined + +- name: Download the amphora + get_url: + url: "{{ download_url }}" + dest: "{{ target_dir }}/amphora.qcow2"