forked from NeCTAR-RC/heat-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource_group.yaml
74 lines (56 loc) · 2.72 KB
/
resource_group.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#heat-template-version
heat_template_version: 2014-10-16
# For more see http://hardysteven.blogspot.com.au/2014/09/using-heat-resourcegroup-resources.html
description: |
A template to demonstrate resource groups. The resource group launches the basic instance template,
passing the parameters entered through to it. It then returns the attributes and shows them as outputs.
To run it, you need to launch it from the command line. Change directory to the directory this template
is in, then use a command along the lines of:
heat stack-create -f resource_group.yaml -P key_name=your_key resource_group_demo
parameters:
key_name:
type: string
description: Name of an existing KeyPair to enable SSH access to the instances
instance_type:
type: string
description: The NeCTAR flavour the webserver is to run on
default: m2.xsmall
constraints:
- allowed_values: [m2.xsmall, m2.small, m1.small]
description:
Must be a valid NeCTAR flavour, limited to the smaller ones available
image_id:
type: string
description: ID of the image to use for the instance to be created
default: fc48b5bb-e67d-4e39-b9ba-b6725c8b0c88
resources:
resource_group:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::ResourceGroup
type: "OS::Heat::ResourceGroup"
properties:
count: 2
resource_def:
type: "https://raw.githubusercontent.com/NeCTAR-RC/heat-templates/master/juno/basic_instance.yaml"
properties:
key_name: { get_param: key_name }
image_id: { get_param: image_id }
instance_type: { get_param: instance_type }
outputs:
attributes:
description: A map of resource names to the specified attribute of each individual resource
value: { get_attr: [ resource_group, attributes ] }
refs:
description: A list of resource IDs for the resources in the group
value: { get_attr: [ resource_group, refs ] }
first_resource_ref:
description: The first resource reference
value: { get_attr: [ resource_group, resource.0 ] }
instance_ip:
description: The IP address of the deployed instance
value: { get_attr: [ resource_group, resource.0.instance_ip ] }
instance_networks:
description: 'A dict of assigned network addresses of the form: {“public”: [ip1, ip2...], “private”: [ip3, ip4]}'
value: { get_attr: [ resource_group, resource.0.instance_networks] }
joined_networks:
description: How to drill down (assuming that tasmania is the availibility zone in which the instance is running)
value: { list_join: [ ',', { get_attr: [ resource_group, resource.0.instance_networks, tas ] } ] }