Skip to content

Instantly share code, notes, and snippets.

@liusheng
Created November 30, 2018 01:13
Show Gist options
  • Save liusheng/3ee7df5874d44b79b687f7e64cf18ac0 to your computer and use it in GitHub Desktop.
Save liusheng/3ee7df5874d44b79b687f7e64cf18ac0 to your computer and use it in GitHub Desktop.
upload cirros image
#!/bin/bash
export OS_IMAGE_NAME="cirros-0.4.0-x86_64-disk"
export OS_IMAGE_ID="$(openstack image show $OS_IMAGE_NAME -f value -c id)"
if [ -z "$OS_IMAGE_ID" ]; then
curl -O http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
export OS_IMAGE_ID="$(openstack image create --file ./cirros-0.4.0-x86_64-disk.img --min-disk 1 --container-format bare --disk-format raw cirros-0.4.0-x86_64-disk -f value -c id)"
rm cirros-0.4.0-x86_64-disk.img
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment