-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3-deploy-as-vm.yaml
116 lines (101 loc) · 3.35 KB
/
3-deploy-as-vm.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
heat_template_version: 2014-10-16
description: Simple template to deploy an autoscaling group
parameters:
key_name:
type: string
label: Key Name
description: Name of key-pair to be used for compute instance \
execute "$ nova keypair-list" to get a list if available keys
default: son-ift-ptin
image_id:
type: string
label: Image ID
description: Image to be used for compute instance
default: centos7-cldimg
constraints:
- allowed_values: [ centos7-cldimg, trusty-cldimg, xenial-cldimg ]
description: execute "$ glance image-list" to get a list if available images
flavor_id:
type: string
label: Instance Type
description: Type of instance (flavor) to be used
default: m1.small
constraints:
- allowed_values: [ m1.tiny, m1.small, m1.medium, m1.large, m1.xlarge ]
description: execute "$ nova flavor-list" to get a list if available flavors
network_id:
type: string
label: Network ID
description:
default: qual-netw
constraints:
- allowed_values: [ qual-netw, admin_floating_net ]
description: execute "$ neutron net-list" to get a list if available network segments
sec_grp:
type: string
label: Security Group
description: SSH, HTTP, HTTPS, 8080, 3821
constraints:
- allowed_values: [ qual-secgrp, jk, squid, ssh, www ]
default: qual-secgrp
resources:
asg:
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: flavor_id }
networks: [{network: {get_param: network_id} }]
security_groups:
- { get_param: sec_grp }
metadata: {"metering.stack": {get_param: "OS::stack_id"}}
user_data: ~/son-install/utils/ansible-install-Core.sh
user_data_format: RAW
min_size: 1
desired_capacity: 1
max_size: 5
scale_up_policy:
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: asg}
cooldown: 60
scaling_adjustment: 1
scale_dw_policy:
type: OS::Heat::ScalingPolicy
properties:
adjustment_type: change_in_capacity
auto_scaling_group_id: {get_resource: asg}
cooldown: 60
scaling_adjustment: '-1'
CPUAlarmHigh:
type: OS::Ceilometer::Alarm
properties:
description: Scale-up if the average CPU > 75% for 10 minutes
meter_name: cpu_util
statistic: avg
period: '120'
evaluation_periods: '1'
threshold: '75'
alarm_actions: [{get_attr: [scale_up_policy, alarm_url]}]
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: gt
CPUAlarmLow:
type: OS::Ceilometer::Alarm
properties:
description: Scale-down if the average CPU < 25% for 10 minutes
meter_name: cpu_util
statistic: avg
period: '120'
evaluation_periods: '1'
threshold: '25'
alarm_actions: [{get_attr: [scale_dw_policy, alarm_url]}]
matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}}
comparison_operator: lt
outputs:
instance_ip:
description: the IP address of the instance
value: { get_attr: [asg, first_address] }