blob: 588b0c95bca856fd8b16a7bc01c9e5fd71eca7eb [file] [log] [blame]
Mateusz Lose2ad0772020-02-27 21:41:54 +01001heat_template_version: queens
2
3parameters:
4
5 metadata:
6 type: json
7 default: {}
8 node_type:
9 type: string
10 key_name:
11 type: string
12 description: Name of keypair to assign to servers
13 image:
14 type: string
15 description: Name of image to use for servers
16 flavor:
17 type: string
18 description: Flavor to use for servers
19 accessible_network:
20 type: string
21 accessible_subnet_id:
22 type: string
23 private_floating_network:
24 type: string
25 private_floating_network_cidr:
26 type: string
27 private_floating_subnet_id:
28 type: string
29 private_floating_interface:
30 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020031 storage_backend_network_cidr:
32 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010033 storage_backend_network:
34 type: string
35 storage_backend_subnet_id:
36 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020037 storage_backend_interface:
38 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010039 storage_frontend_network:
40 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020041 storage_frontend_network_cidr:
42 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010043 storage_frontend_subnet_id:
44 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020045 storage_frontend_interface:
46 type: string
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020047 control_network_cidr:
Mateusz Lose2ad0772020-02-27 21:41:54 +010048 type: string
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030049 ironic_baremetal_network:
50 type: string
51 ironic_baremetal_subnet_id:
52 type: string
Vasyl Saienko4c468192020-05-19 11:51:13 +030053 ironic_baremetal_network_cidr:
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030054 type: string
Anton Samoylovea0b23e2020-06-26 14:17:51 +040055 tungstenfabric_enabled:
56 type: boolean
57 tf_data_network:
58 type: string
59 tf_data_subnet_id:
60 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010061 functions_override:
62 type: string
63 boot_timeout:
64 type: number
65 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020066 default: 3600
Mateusz Lose2ad0772020-02-27 21:41:54 +010067 ucp_master_host:
68 type: string
69 default: ''
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030070 docker_ucp_image:
71 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010072 public_net_id:
73 type: string
74 docker_ee_release:
75 type: string
76 docker_ee_url:
77 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020078 hardware_metadata:
79 description: The content of lab metadata.
80 type: string
Oleh Hryhorov33e30e22020-03-12 11:51:40 +020081 user_data_config:
82 description: This is part of clout-config which denies to mount drive with label ephemeral0 to /mnt
83 type: string
84 default: |
85 #cloud-config
86 #
87 # Don't mount ephemeral0 to /mnt as it's by default
88 mounts:
89 - [ ephemeral0, null ]
Mateusz Lose2ad0772020-02-27 21:41:54 +010090
Anton Samoylovea0b23e2020-06-26 14:17:51 +040091conditions:
92 create_tf_data_network_res:
93 get_param: tungstenfabric_enabled
94
Mateusz Lose2ad0772020-02-27 21:41:54 +010095resources:
96
97 software_config:
98 type: OS::Heat::SoftwareConfig
99 properties:
100 group: ungrouped
101 config:
102 str_replace:
103 template: { get_file: ../scripts/instance_boot.sh }
104 params:
105 $node_type: { get_param: node_type }
106 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100107 $docker_ee_url: { get_param: docker_ee_url }
108 $docker_ee_release: { get_param: docker_ee_release }
109 $ucp_master_host: { get_param: ucp_master_host }
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +0300110 $docker_ucp_image: { get_param: docker_ucp_image }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100111 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +0200112 $control_network_cidr: { get_param: control_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100113 $private_floating_interface: { get_param: private_floating_interface }
114 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
115 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
116 $functions_override: { get_param: functions_override }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200117 $storage_frontend_interface: { get_param: storage_frontend_interface }
118 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
119 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
120 $storage_backend_interface: { get_param: storage_backend_interface }
121 $storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
122 $storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300123 $ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
Vasyl Saienko4c468192020-05-19 11:51:13 +0300124 $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100125
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200126 inject_files:
127 type: "OS::Heat::CloudConfig"
128 properties:
129 cloud_config:
130 write_files:
131 - path: /usr/sbin/prepare-metadata.py
132 owner: "root:root"
133 permissions: "0755"
134 content: {get_file: ../scripts/prepare-metadata.py}
135 - path: /usr/share/metadata/lab-metadata.yaml
136 owner: "root:root"
137 permissions: "0644"
138 content: { get_param: hardware_metadata}
139
140 install_config_agent:
141 type: "OS::Heat::MultipartMime"
142 properties:
143 parts:
144 - config: {get_resource: software_config}
145 - config: {get_resource: inject_files}
Oleh Hryhorov33e30e22020-03-12 11:51:40 +0200146 - config: {get_param: user_data_config}
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200147
Mateusz Lose2ad0772020-02-27 21:41:54 +0100148 server:
149 type: OS::Nova::Server
150 properties:
151 image: { get_param: image }
152 flavor: { get_param: flavor }
153 key_name: { get_param: key_name }
154 availability_zone: nova
155 networks:
Anton Samoylovea0b23e2020-06-26 14:17:51 +0400156 if:
157 - "create_tf_data_network_res"
158 - - port: { get_resource: accessible_server_port }
159 - port: { get_resource: private_floating_server_port }
160 - port: { get_resource: storage_frontend_server_port }
161 - port: { get_resource: storage_backend_server_port }
162 - port: { get_resource: ironic_baremetal_server_port }
163 - port: { get_resource: tf_data_server_port }
164 - - port: { get_resource: accessible_server_port }
165 - port: { get_resource: private_floating_server_port }
166 - port: { get_resource: storage_frontend_server_port }
167 - port: { get_resource: storage_backend_server_port }
168 - port: { get_resource: ironic_baremetal_server_port }
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200169 user_data_format: SOFTWARE_CONFIG
170 user_data: { get_resource: install_config_agent}
Mateusz Lose2ad0772020-02-27 21:41:54 +0100171 metadata: { get_param: metadata }
172
173 accessible_server_port:
174 type: OS::Neutron::Port
175 properties:
176 network_id: { get_param: accessible_network }
177 port_security_enabled: false
178 fixed_ips:
179 - subnet: { get_param: accessible_subnet_id }
180
181 storage_backend_server_port:
182 type: OS::Neutron::Port
183 properties:
184 network_id: { get_param: storage_backend_network }
185 port_security_enabled: false
186 fixed_ips:
187 - subnet: { get_param: storage_backend_subnet_id }
188
189 storage_frontend_server_port:
190 type: OS::Neutron::Port
191 properties:
192 network_id: { get_param: storage_frontend_network }
193 port_security_enabled: false
194 fixed_ips:
195 - subnet: { get_param: storage_frontend_subnet_id }
196
197 private_floating_server_port:
198 type: OS::Neutron::Port
199 properties:
200 network_id: { get_param: private_floating_network }
201 port_security_enabled: false
202 fixed_ips:
203 - subnet: { get_param: private_floating_subnet_id }
204
205 server_floating_ip:
206 type: OS::Neutron::FloatingIP
207 properties:
208 floating_network_id: { get_param: public_net_id }
209 port_id: { get_resource: accessible_server_port }
210
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300211 ironic_baremetal_server_port:
212 type: OS::Neutron::Port
213 properties:
214 network_id: { get_param: ironic_baremetal_network }
215 port_security_enabled: false
216 fixed_ips:
217 - subnet: { get_param: ironic_baremetal_subnet_id }
218
Anton Samoylovea0b23e2020-06-26 14:17:51 +0400219 tf_data_server_port:
220 type: OS::Neutron::Port
221 condition: create_tf_data_network_res
222 properties:
223 network_id: { get_param: tf_data_network }
224 port_security_enabled: false
225 fixed_ips:
226 - subnet: { get_param: tf_data_subnet_id }
227
Mateusz Lose2ad0772020-02-27 21:41:54 +0100228 wait_handle:
229 type: OS::Heat::WaitConditionHandle
230 wait_condition:
231 type: OS::Heat::WaitCondition
232 properties:
233 handle: { get_resource: wait_handle }
234 timeout: { get_param: boot_timeout }
235
236outputs:
237 server_private_ip:
238 description: IP address of server in private network
239 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
240 server_private_floating_ip:
241 description: IP address of server in private floating network
242 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
Vasyl Saienko4e3f4632020-05-26 14:43:09 +0300243 server_ironic_baremetal_ip:
244 description: IP address of server in ironic baremetal network
245 value: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
Anton Samoylovea0b23e2020-06-26 14:17:51 +0400246 server_tf_data_ip:
247 description: IP address of server in tf data network
248 value: { get_attr: [tf_data_server_port, fixed_ips, 0, ip_address] }
249 condition: create_tf_data_network_res
Mateusz Lose2ad0772020-02-27 21:41:54 +0100250 server_public_ip:
251 description: Floating IP address of server in public network
252 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200253 wc_data:
254 description: Metadata from instance
255 value: { get_attr: [wait_condition, data]}