Skip to content

Instantly share code, notes, and snippets.

@samos123
Created October 31, 2014 09:20
Show Gist options
  • Save samos123/961f410ae76c9fa6989f to your computer and use it in GitHub Desktop.
Save samos123/961f410ae76c9fa6989f to your computer and use it in GitHub Desktop.
A heat template which creates a vm booted from a cinder volume that contains the image
heat_template_version: 2013-05-23
description: >
A HOT template that holds a VM instance booted from Volume where the image
is copied to the volume automatically. The VM does nothing, it is only created.
parameters:
key_name:
type: string
description: Name of an existing key pair to use for the instance
constraints:
- custom_constraint: nova.keypair
description: Must name a public key (pair) known to Nova
flavor:
type: string
description: Flavor for the instance to be created
default: m1.small
constraints:
- custom_constraint: nova.flavor
description: Must be a flavor known to Nova
image:
type: string
description: >
Name or ID of the image to use for the instance.
You can get the default from
http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2
There is also
http://cloud.fedoraproject.org/fedora-20.i386.qcow2
Any image should work since this template
does not ask the VM to do anything.
constraints:
- custom_constraint: glance.image
description: Must identify an image known to Glance
network:
type: string
description: The network for the VM
default: private
vol_size:
type: number
description: The size of the Cinder volume
default: 5
resources:
my_instance:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
block_device_mapping: [{"volume_id": { get_resource: my_vol },
"delete_on_termination": false,
"device_name": "vda"}]
flavor: { get_param: flavor }
networks: [{network: {get_param: network} }]
my_vol:
type: OS::Cinder::Volume
properties:
size: { get_param: vol_size }
image: { get_param: image }
outputs:
instance_networks:
description: The IP addresses of the deployed instance
value: { get_attr: [my_instance, networks] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment