forked from NeCTAR-RC/heat-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver_group.yaml
89 lines (73 loc) · 2.94 KB
/
server_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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#heat-template-version
heat_template_version: 2014-10-16
parameters:
key_name:
type: string
description: Name of an existing KeyPair to enable SSH access to instance two
constraints:
- custom_constraint: nova.keypair
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: 7313d773-3cd9-4e69-98d2-eff1f9797480
resources:
policy_group:
# Server groups aren't supported by NeCTAR, it turns out.
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Nova::ServerGroup
type: OS::Nova::ServerGroup
# A Nova ServerGroup
properties:
name: nova-server-group
# see http://dev.cloudwatt.com/en/blog/affinity-and-anti-affinity-in-openstack.html
# policies: [affinity]
# If we uncomment the scheduler_hints, this template will fail:
# This is because server groups aren't supported by NeCTAR
auto_scaling_group:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::AutoScalingGroup
type: OS::Heat::AutoScalingGroup
properties:
resource:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image_id }
flavor: { get_param: instance_type }
#scheduler_hints: { group: { get_resource: policy_group }}
min_size: 1
desired_capacity: 3
max_size: 5
scale_up_policy:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::ScalingPolicy
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: { get_resource: auto_scaling_group }
cooldown: 60
scaling_adjustment: 1
scale_down_policy:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::ScalingPolicy
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: { get_resource: auto_scaling_group }
cooldown: 60
scaling_adjustment: '-1'
outputs:
scale_up_url:
description: >
This URL is the webhook to scale the group up. Invoke by doing an HTTP POST to this URL.
No body or other headers is needed. But do put quotes around the url!
value: { get_attr: [scale_up_policy, alarm_url] }
scale_down_url:
description: >
This URL is the webhook to scale the group down. Invoke by doing an HTTP POST to this URL.
No body or other headers is needed. But do put quotes around the url
value: { get_attr: [scale_down_policy, alarm_url] }