-
Notifications
You must be signed in to change notification settings - Fork 12
/
server_with_apache.yaml
89 lines (76 loc) · 2.5 KB
/
server_with_apache.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
heat_template_version: 2021-04-16
description: >
Nectar web_server template - A template based on the basic server
template, but installs the Apache web server using a user_data
script and a wait_handle.
parameters:
key_name:
type: string
description: Name of an existing keypair to enable SSH access to the instance
constraints:
- custom_constraint: nova.keypair
flavor:
type: string
description: The Nectar instance flavour the instance should use
default: m3.xsmall
constraints:
- custom_constraint: nova.flavor
image:
type: string
description: ID or name of the image to use for the instance to be created
default: NeCTAR Ubuntu 22.04 LTS (Jammy) amd64
availability_zone:
type: string
description: The Nectar availability zone to launch in
resources:
wait_handle:
type: OS::Heat::WaitConditionHandle
wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: { get_resource: wait_handle }
count: 1
timeout: 600
secgroup:
# https://docs.openstack.org/heat/latest/template_guide/openstack.html#OS::Neutron::SecurityGroup
type: OS::Neutron::SecurityGroup
properties:
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 22
port_range_max: 22
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 80
port_range_max: 80
server:
# https://docs.openstack.org/heat/latest/template_guide/openstack.html#OS::Nova::Server
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: { get_param: image }
flavor: { get_param: flavor }
availability_zone: { get_param: availability_zone }
security_groups:
- { get_resource: secgroup }
networks:
- allocate_network: auto
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/bash -ex
apt-get update
apt-get -y install apache2
echo -e "<html>\n<body>\nI am <b>$(hostname)</b>\n</body>\n</html>" > /var/www/html/index.html
# notify heat that we are done here
wc_notify --data-binary '{"status": "SUCCESS"}'
params:
wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
outputs:
ip_address:
description: The IP address of the deployed instance
value: { get_attr: [server, first_address] }