forked from NeCTAR-RC/heat-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfedora_apache_single_instance_nova.yaml
More file actions
133 lines (110 loc) · 4.14 KB
/
fedora_apache_single_instance_nova.yaml
File metadata and controls
133 lines (110 loc) · 4.14 KB
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
124
125
126
127
128
129
130
131
132
133
# http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#heat-template-version
heat_template_version: 2014-10-16
# This script only works with images that have the full Heat software installed on them...
# None of the Nectar images do at the moment :(
# from
# http://docs.openstack.org/developer/heat/template_guide/software_deployment.html
# https://github.com/openstack/heat-templates/blob/master/hot/software-config/example-templates/wordpress/WordPress_software-config_1-instance.yaml
description: Install Apache on a single OpenSuse instance using the OS::Nova::Server resource type.
parameters:
key_name:
type: string
label: Key Name
description: Name of an existing KeyPair to enable SSH access to the instances.
image_name:
type: string
label: Image ID
description: Image to be used for compute instance
default: Fedora_21
constraints:
- allowed_values: [Fedora_20, Fedora_21 ]
description: Value must be one of Fedora_20 or Fedora_21
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
resources:
# Use this when we do not have Neutron networking.
# http://docs.openstack.org/developer/heat/template_guide/cfn.html#AWS::EC2::SecurityGroup
web_security_group:
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}
- {IpProtocol: tcp, FromPort: '80', ToPort: '80', CidrIp: 0.0.0.0/0}
- {IpProtocol: tcp, FromPort: '443', ToPort: '443', CidrIp: 0.0.0.0/0}
apache_config:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: foo
- name: bar
outputs:
- { type: String, name: result }
config: |
#!/bin/sh -x
echo "Writing to /tmp/$bar"
echo $foo > /tmp/$bar
echo -n "The file /tmp/$bar contains `cat /tmp/$bar` for server $deploy_server_id during $deploy_action" > $heat_outputs_path.result
echo "Written to /tmp/$bar"
echo "Output to stderr" 1>&2
# #!/bin/sh -x
# yum install httpd
# /etc/init.d/httpd start
# echo -n "The sever deploy is complete" > $heat_outputs_path.result
apache_server:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Nova::Server
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image:
Fn::Select:
- { get_param: image_name }
-
Fedora_20: d3bae233-a0cd-4533-a710-d7aa9de0a4b7
Fedora_21: db354243-aba2-4831-81c7-a155b9089291
flavor: { get_param: instance_type }
security_groups:
- { get_resource: web_security_group }
user_data_format: SOFTWARE_CONFIG
apache_deployment:
type: OS::Heat::SoftwareDeployment
properties:
config:
get_resource: apache_config
server:
get_resource: apache_server
input_values:
foo: fooooo
bar: baaaaa
wait_handle:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::WaitConditionHandle
type: OS::Heat::WaitConditionHandle
wait_condition:
# http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Heat::WaitCondition
type: OS::Heat::WaitCondition
depends_on: apache_server
properties:
handle: { get_resource: wait_handle }
count: 1
# we'll give it 10 minutes
timeout: 600
outputs:
# result:
# value:
# get_attr: [ apache_config, result ]
instance_ip:
description: The IP address of the deployed instance
value:
get_attr: [ apache_server, first_address ]
website_url:
description: URL for Apache server
value:
list_join: [ '', ['http://', get_attr: [ apache_server, first_address ] ] ]