Add ability to download an image from the Internet to upload it to Glance
Unfortunately, it seems Glance v2 does not have the capability to upload an image by referencing a URL, it has to be a local file. Adding logic to the role and flags should the user want to pull an image to the Ansible control machine prior to the usual upload. Change-Id: I2e2886287a045dab89fe712e39b42c2383d6aec6
This commit is contained in:
parent
11483dafd4
commit
fe8af280a4
@ -5,3 +5,5 @@ generate_keypair: no
|
||||
generate_keypair_folder: /tmp
|
||||
generate_keypair_key_type: rsa
|
||||
generate_keypair_key_bits: 2048
|
||||
download_image_dest: /tmp
|
||||
download_image_force: no
|
||||
|
@ -1,4 +1,14 @@
|
||||
---
|
||||
- block:
|
||||
- os_image_facts:
|
||||
cloud: "{{ item_cloud.oscc_cloud|default(item_cloud.name) }}"
|
||||
image: "{{ item_image.name }}"
|
||||
- get_url:
|
||||
url: "{{ item_image.download_image_url }}"
|
||||
dest: "{{ item_image.download_image_dest|default(download_image_dest) }}"
|
||||
force: "{{ item_image.download_image_force|default(download_image_force) }}"
|
||||
when: not openstack_image
|
||||
when: item_image.download_image_url is defined
|
||||
- os_image:
|
||||
cloud: "{{ item_cloud.oscc_cloud|default(item_cloud.name) }}"
|
||||
state: "{{ item_image.state|default(omit) }}"
|
||||
|
@ -19,6 +19,11 @@ clouds:
|
||||
profiles:
|
||||
- test_profile_a
|
||||
- test_profile_b
|
||||
images:
|
||||
- name: test_image
|
||||
download_image_url: "file:///opt/stack/cache/files/cirros-0.3.4-x86_64-disk.img"
|
||||
download_image_dest: /tmp/test_image.img
|
||||
filename: /tmp/test_image.img
|
||||
servers:
|
||||
- name: test_server_a
|
||||
image: cirros-0.3.4-x86_64-uec
|
||||
|
@ -53,6 +53,14 @@
|
||||
- name: Assert test-server-a server has been created
|
||||
assert: { that: result.rc == 0 }
|
||||
|
||||
- name: Querying for test_image image
|
||||
command: openstack --os-cloud devstack-admin image show test_image
|
||||
register: result
|
||||
changed_when: False
|
||||
|
||||
- name: Assert test_image server has been created
|
||||
assert: { that: result.rc == 0 }
|
||||
|
||||
- name: Querying for test_server_b server
|
||||
command: openstack --os-cloud devstack server show test_server_b
|
||||
register: result
|
||||
|
Loading…
x
Reference in New Issue
Block a user