blob: f0340223723d4f38b62f2313103ba59b307722e6 [file] [log] [blame]
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +02001heat_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
31 storage_backend_network_cidr:
32 type: string
33 storage_backend_network:
34 type: string
35 storage_backend_subnet_id:
36 type: string
37 storage_backend_interface:
38 type: string
39 storage_frontend_network:
40 type: string
41 storage_frontend_network_cidr:
42 type: string
43 storage_frontend_subnet_id:
44 type: string
45 storage_frontend_interface:
46 type: string
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020047 control_network_cidr:
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020048 type: string
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030049 ironic_baremetal_network:
50 type: string
51 ironic_baremetal_subnet_id:
52 type: string
53 ironic_baremetal_interface:
54 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020055 functions_override:
56 type: string
57 boot_timeout:
58 type: number
59 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020060 default: 3600
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020061 ucp_master_host:
62 type: string
63 default: ''
64 public_net_id:
65 type: string
66 default: ''
67 docker_ee_release:
68 type: string
69 docker_ee_url:
70 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020071 hardware_metadata:
72 description: The content of lab metadata.
73 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020074
75resources:
76
77 software_config:
78 type: OS::Heat::SoftwareConfig
79 properties:
80 group: ungrouped
81 config:
82 str_replace:
83 template: { get_file: ../scripts/instance_boot.sh }
84 params:
85 $node_type: { get_param: node_type }
86 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
87 $ucp_license_key: { get_file: ../scripts/license.lic }
88 $docker_ee_url: { get_param: docker_ee_url }
89 $docker_ee_release: { get_param: docker_ee_release }
90 $ucp_master_host: { get_param: ucp_master_host }
91 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020092 $control_network_cidr: { get_param: control_network_cidr }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020093 $private_floating_interface: { get_param: private_floating_interface }
94 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
95 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
96 $functions_override: { get_param: functions_override }
97 $storage_frontend_interface: { get_param: storage_frontend_interface }
98 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
99 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
100 $storage_backend_interface: { get_param: storage_backend_interface }
101 $storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
102 $storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300103 $ironic_baremetal_interface: { get_param: ironic_baremetal_interface }
104 $ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200105
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200106 inject_files:
107 type: "OS::Heat::CloudConfig"
108 properties:
109 cloud_config:
110 write_files:
111 - path: /usr/sbin/prepare-metadata.py
112 owner: "root:root"
113 permissions: "0755"
114 content: {get_file: ../scripts/prepare-metadata.py}
115 - path: /usr/share/metadata/lab-metadata.yaml
116 owner: "root:root"
117 permissions: "0644"
118 content: { get_param: hardware_metadata}
119
120 install_config_agent:
121 type: "OS::Heat::MultipartMime"
122 properties:
123 parts:
124 - config: {get_resource: software_config}
125 - config: {get_resource: inject_files}
126
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200127 server:
128 type: OS::Nova::Server
129 properties:
130 image: { get_param: image }
131 flavor: { get_param: flavor }
132 key_name: { get_param: key_name }
133 availability_zone: nova
134 networks:
135 - network: { get_param: accessible_network }
136 # NOTE(ohryhorov): connect to accessible network only as ironic doesn't
137 # support multitenancy use-case. Use private_floating_network for IPAM only.
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300138 # NOTE(vsaienko): ditto about ironic network
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200139 user_data_format: SOFTWARE_CONFIG
140 user_data: { get_resource: install_config_agent}
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200141 metadata: { get_param: metadata }
142
143 private_floating_server_port:
144 type: OS::Neutron::Port
145 properties:
146 network_id: { get_param: private_floating_network }
147 port_security_enabled: false
148 fixed_ips:
149 - subnet: { get_param: private_floating_subnet_id }
150
151 storage_backend_server_port:
152 type: OS::Neutron::Port
153 properties:
154 network_id: { get_param: storage_backend_network }
155 port_security_enabled: false
156 fixed_ips:
157 - subnet: { get_param: storage_backend_subnet_id }
158
159 storage_frontend_server_port:
160 type: OS::Neutron::Port
161 properties:
162 network_id: { get_param: storage_frontend_network }
163 port_security_enabled: false
164 fixed_ips:
165 - subnet: { get_param: storage_frontend_subnet_id }
166
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300167 ironic_baremetal_server_port:
168 type: OS::Neutron::Port
169 properties:
170 network_id: { get_param: ironic_baremetal_network }
171 port_security_enabled: false
172 fixed_ips:
173 - subnet: { get_param: ironic_baremetal_subnet_id }
174
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200175 wait_handle:
176 type: OS::Heat::WaitConditionHandle
177 wait_condition:
178 type: OS::Heat::WaitCondition
179 properties:
180 handle: { get_resource: wait_handle }
181 timeout: { get_param: boot_timeout }
182
183
184outputs:
185 server_private_ip:
186 description: IP address of server in private network
187 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
188 server_private_floating_ip:
189 description: IP address of server in private floating network
190 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
191 server_public_ip:
192 description: Floating IP address of server in public network
193 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200194 wc_data:
195 description: Metadata from instance
196 value: { get_attr: [wait_condition, data]}