From 4ac60cf090af9618bd52b4b30cac4ee31b5d5967 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 5 Nov 2017 13:24:37 +1100 Subject: Add ansible playbooks for 3 minute multi-cloud demo --- .../roles/upload-image/defaults/main.yaml | 3 +++ .../roles/upload-image/tasks/main.yaml | 25 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/three-minute-demo/roles/upload-image/defaults/main.yaml create mode 100644 src/three-minute-demo/roles/upload-image/tasks/main.yaml (limited to 'src/three-minute-demo/roles/upload-image') diff --git a/src/three-minute-demo/roles/upload-image/defaults/main.yaml b/src/three-minute-demo/roles/upload-image/defaults/main.yaml new file mode 100644 index 0000000..b6283b8 --- /dev/null +++ b/src/three-minute-demo/roles/upload-image/defaults/main.yaml @@ -0,0 +1,3 @@ +distro: debian +image_formats: +- qcow2 diff --git a/src/three-minute-demo/roles/upload-image/tasks/main.yaml b/src/three-minute-demo/roles/upload-image/tasks/main.yaml new file mode 100644 index 0000000..c14c7eb --- /dev/null +++ b/src/three-minute-demo/roles/upload-image/tasks/main.yaml @@ -0,0 +1,25 @@ +# All three are marked no_log because auth info from clouds.yaml is being +# extracted and passed around + +- name: Check for existing images + os_image_facts: + cloud: "{{ item.name }}" + region_name: "{{ item.region_name }}" + image: "three-minute-demo-image" + with_items: "{{ openstack.clouds }}" + no_log: true + register: image_records + +- name: Get list of clouds without image + set_fact: + clouds_without_image: "{{ image_records.results|json_query('[?ansible_facts.openstack_image==null].item') }}" + no_log: true + +- name: Upload image if it's not there + os_image: + cloud: "{{ item.name }}" + region_name: "{{ item.region_name }}" + name: "three-minute-demo-image" + filename: "{{ distro }}.{{ item.image_format }}" + no_log: true + with_items: "{{ clouds_without_image }}" -- cgit v1.2.3