diff options
| author | Monty Taylor <mordred@inaugust.com> | 2017-11-05 13:24:37 +1100 |
|---|---|---|
| committer | Monty Taylor <mordred@inaugust.com> | 2017-11-05 17:07:06 +1100 |
| commit | 4ac60cf090af9618bd52b4b30cac4ee31b5d5967 (patch) | |
| tree | 7dda33747456c3b806d25c4318bef9b717f8aa3e /src/three-minute-demo/roles/upload-image/tasks | |
| parent | 2f5dfc495113c6dadf66fc7d5d395f90118514ca (diff) | |
Add ansible playbooks for 3 minute multi-cloud demo
Diffstat (limited to 'src/three-minute-demo/roles/upload-image/tasks')
| -rw-r--r-- | src/three-minute-demo/roles/upload-image/tasks/main.yaml | 25 |
1 files changed, 25 insertions, 0 deletions
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 }}" | ||
