heat-templates/hot/resource_group/server_with_volumes.yaml

58 lines
1.4 KiB
YAML

heat_template_version: 2013-05-23
description: >
Example of using ResourceGroup to attach multiple volumes to an instance
parameters:
key_name:
type: string
description: keypair to enable SSH access to the instance.
default: stack_key
image_id:
type: string
description: ID of the image to use for the instance to be created.
default: cirros-0.3.2-x86_64-disk
volume_size:
type: number
description: Size of volume to attach to instance
default: 1
constraints:
- range: { min: 1, max: 10 }
num_volumes:
type: number
description: Number of volumes to attach to instance
default: 2
constraints:
- range: { min: 1, max: 10 }
instance_type:
type: string
description: Type of the instance to be created.
default: m1.nano
resources:
instance:
type: OS::Nova::Server
properties:
image: { get_param: image_id }
flavor: { get_param: instance_type }
key_name: { get_param: key_name }
group_of_volumes:
type: OS::Heat::ResourceGroup
properties:
count: { get_param: num_volumes }
resource_def:
type: volume_with_attachment.yaml
properties:
instance_id: { get_resource: instance }
volume_size: { get_param: volume_size }
outputs:
server_ip:
description: IP Address of server having volumes attached.
value: { get_attr: [instance, first_address] }