forked from NeCTAR-RC/heat-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructured_deployment.yaml
124 lines (103 loc) · 3.76 KB
/
structured_deployment.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
117
118
119
120
121
122
123
# http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#heat-template-version
heat_template_version: 2014-10-16
# This template does not yet work: not all of the software required is installed on NeCTAR images.
# A customization of one of the OpenStack sample templates
# at https://github.com/openstack/heat-templates/ for the NeCTAR environment
description: >
This template demonstrates how to use OS::Heat::StructuredDeployment
to apply config via os-apply-config. Note this requires your image to
be built with the ntp element added (not included in the instructions
in this repo by default, you'll have to add it and rebuild).
This example includes additional configuration of cloud-init via
the user-data in addition to the StructuredDeployment
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_name:
type: string
description: Name of the Ubuntu image to use for the instance to be created.
default: 'Ubuntu 14.04'
constraints:
- allowed_values: [ 'Ubuntu 14.04', 'Ubuntu 15.04' ]
description:
Must be a valid NeCTAR image name, limited to the LTS Ubuntu releases
ntp_server:
type: string
default: 0.uk.pool.ntp.org
resources:
security_group:
# Use this when we do not have Neutron networking.
# http://docs.openstack.org/developer/heat/template_guide/cfn.html#AWS::EC2::SecurityGroup
type: AWS::EC2::SecurityGroup
properties:
GroupDescription: Web server access rules.
SecurityGroupIngress:
- { IpProtocol: icmp, FromPort: '-1', ToPort: '-1', CidrIp : 0.0.0.0/0 }
- { IpProtocol: tcp, FromPort: '22', ToPort: '22', CidrIp: 0.0.0.0/0 }
config:
type: OS::Heat::StructuredConfig
properties:
# https://pypi.python.org/pypi/os-apply-config
# https://launchpad.net/os-apply-config
group: os-apply-config
config:
ntp:
servers:
- {server: {get_param: ntp_server}}
deployment:
type: OS::Heat::StructuredDeployment
properties:
config:
get_resource: config
server:
get_resource: server
cloud_init_userdata:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: cloud_config}
cloud_config:
type: OS::Heat::CloudConfig
properties:
cloud_config:
write_files:
- path: /tmp/one
content: "The one is bar"
server:
type: OS::Nova::Server
properties:
image:
Fn::Select:
- { get_param: image_name }
-
'Ubuntu 14.04': 7313d773-3cd9-4e69-98d2-eff1f9797480
'Ubuntu 15.04': 2ae1042a-8f8d-4f40-95c7-6d1e611714be
flavor: {get_param: instance_type}
key_name: {get_param: key_name}
security_groups:
- {get_resource: security_group}
user_data_format: SOFTWARE_CONFIG
user_data:
get_resource: cloud_init_userdata
outputs:
server_ip:
description: IP Address of server.
value: { get_attr: [server, first_address] }
deployment_status:
description: Status code of configuration execution.
value: { get_attr: [deployment, deploy_status_code] }
deployment_stdout:
description: Standard output captured from the configuration execution.
value: { get_attr: [deployment, deploy_stdout] }
deployment_stderr:
description: Standard error captured from the configuration execution.
value: { get_attr: [deployment, deploy_stderr] }