Upload cirros image automatically

Change-Id: Ic531c50008b5be56d5b7af2660267f15ae2411de
This commit is contained in:
Sergey Lukjanov 2016-09-26 09:01:07 -07:00 committed by Yuriy Taraday
parent 60b16f320c
commit f1a6577d78
3 changed files with 36 additions and 0 deletions

View File

@ -26,6 +26,13 @@ configs:
store_create_container_on_put: true
store_container: glance
bootstrap:
enable: false
image:
url: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
disk_format: qcow2
name: cirros
sources:
openstack/glance:
git_url: https://github.com/openstack/glance.git

View File

@ -0,0 +1,17 @@
#!/bin/bash
set -ex
export OS_IDENTITY_API_VERSION=3
export OS_INTERFACE="internal"
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PASSWORD={{ openstack.user_password }}
export OS_USERNAME={{ openstack.user_name }}
export OS_PROJECT_NAME={{ openstack.project_name }}
export OS_AUTH_URL="http://{{ address('keystone', keystone.admin_port) }}/v3"
{% set image = glance.bootstrap.image %}
FILE="$(mktemp)"
curl {{ image.url }} -o "${FILE}"
openstack image create --public --disk-format {{ image.disk_format }} --file "${FILE}" {{ image.name }}
rm "${FILE}"

View File

@ -67,6 +67,14 @@ service:
- glance-swift-conf
# {% endif %}
command: glance-api
# {% if glance.bootstrap.enable %}
post:
- name: glance-cirros-image-upload
type: single
command: /opt/ccp/bin/glance-cirros-image-upload.sh
files:
- glance-cirros-image-upload.sh
# {% endif %}
files:
glance-api:
@ -81,3 +89,7 @@ files:
glance-swift-conf:
path: /etc/glance/glance-swift-store.conf
content: glance-swift-store.conf.j2
glance-cirros-image-upload.sh:
path: /opt/ccp/bin/glance-cirros-image-upload.sh
content: glance-cirros-image-upload.sh.j2
perm: "500"