summaryrefslogtreecommitdiff
path: root/src/three-minute-demo/roles/upload-image
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2017-11-05 13:24:37 +1100
committerMonty Taylor <mordred@inaugust.com>2017-11-05 17:07:06 +1100
commit4ac60cf090af9618bd52b4b30cac4ee31b5d5967 (patch)
tree7dda33747456c3b806d25c4318bef9b717f8aa3e /src/three-minute-demo/roles/upload-image
parent2f5dfc495113c6dadf66fc7d5d395f90118514ca (diff)
Add ansible playbooks for 3 minute multi-cloud demo
Diffstat (limited to 'src/three-minute-demo/roles/upload-image')
-rw-r--r--src/three-minute-demo/roles/upload-image/defaults/main.yaml3
-rw-r--r--src/three-minute-demo/roles/upload-image/tasks/main.yaml25
2 files changed, 28 insertions, 0 deletions
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 @@
1distro: debian
2image_formats:
3- 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 @@
1# All three are marked no_log because auth info from clouds.yaml is being
2# extracted and passed around
3
4- name: Check for existing images
5 os_image_facts:
6 cloud: "{{ item.name }}"
7 region_name: "{{ item.region_name }}"
8 image: "three-minute-demo-image"
9 with_items: "{{ openstack.clouds }}"
10 no_log: true
11 register: image_records
12
13- name: Get list of clouds without image
14 set_fact:
15 clouds_without_image: "{{ image_records.results|json_query('[?ansible_facts.openstack_image==null].item') }}"
16 no_log: true
17
18- name: Upload image if it's not there
19 os_image:
20 cloud: "{{ item.name }}"
21 region_name: "{{ item.region_name }}"
22 name: "three-minute-demo-image"
23 filename: "{{ distro }}.{{ item.image_format }}"
24 no_log: true
25 with_items: "{{ clouds_without_image }}"