aboutsummaryrefslogtreecommitdiffstats
path: root/resources/ansible_roles/openstack/tasks/create_image.yml
blob: b67595ce3b4abb69c231548f69244485e5b483d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##############################################################################
# Copyright (c) 2018 ZTE Corporation and others.
# taseer94@gmail.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

---

- name: create directories for image
  file:
    path: "{{ download_dest }}"
    state: directory

- name: download image as qtip image
  get_url:
    url: "{{ image_url }}"
    dest: "{{ download_dest }}/{{ image_name }}.img"
    checksum: "md5:{{ checksum }}"
  when: image_url | search("https://")

- name: upload qtip image
  os_image:
    name: "{{ image_name }}"
    container_format: bare
    disk_format: qcow2
    state: present
    endpoint_type: admin
    filename: "{{ download_dest }}/{{ image_name }}.img"