blob: f78a1983b1c79305daf03228ee1bab6359b40ae7 [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
49 functions_override:
50 type: string
51 boot_timeout:
52 type: number
53 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020054 default: 3600
Mateusz Lose2ad0772020-02-27 21:41:54 +010055 ucp_master_host:
56 type: string
57 default: ''
58 public_net_id:
59 type: string
60 docker_ee_release:
61 type: string
62 docker_ee_url:
63 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020064 hardware_metadata:
65 description: The content of lab metadata.
66 type: string
Oleh Hryhorov33e30e22020-03-12 11:51:40 +020067 user_data_config:
68 description: This is part of clout-config which denies to mount drive with label ephemeral0 to /mnt
69 type: string
70 default: |
71 #cloud-config
72 #
73 # Don't mount ephemeral0 to /mnt as it's by default
74 mounts:
75 - [ ephemeral0, null ]
Mateusz Lose2ad0772020-02-27 21:41:54 +010076
77resources:
78
79 software_config:
80 type: OS::Heat::SoftwareConfig
81 properties:
82 group: ungrouped
83 config:
84 str_replace:
85 template: { get_file: ../scripts/instance_boot.sh }
86 params:
87 $node_type: { get_param: node_type }
88 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
89 $ucp_license_key: { get_file: ../scripts/license.lic }
90 $docker_ee_url: { get_param: docker_ee_url }
91 $docker_ee_release: { get_param: docker_ee_release }
92 $ucp_master_host: { get_param: ucp_master_host }
93 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020094 $control_network_cidr: { get_param: control_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010095 $private_floating_interface: { get_param: private_floating_interface }
96 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
97 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
98 $functions_override: { get_param: functions_override }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020099 $storage_frontend_interface: { get_param: storage_frontend_interface }
100 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
101 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
102 $storage_backend_interface: { get_param: storage_backend_interface }
103 $storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
104 $storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100105
Oleh Hryhorov6cd21902020-03-05 18:29:31 +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}
Oleh Hryhorov33e30e22020-03-12 11:51:40 +0200126 - config: {get_param: user_data_config}
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200127
Mateusz Lose2ad0772020-02-27 21:41:54 +0100128 server:
129 type: OS::Nova::Server
130 properties:
131 image: { get_param: image }
132 flavor: { get_param: flavor }
133 key_name: { get_param: key_name }
134 availability_zone: nova
135 networks:
136 - port: { get_resource: accessible_server_port }
137 - port: { get_resource: private_floating_server_port }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100138 - port: { get_resource: storage_frontend_server_port }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200139 - port: { get_resource: storage_backend_server_port }
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200140 user_data_format: SOFTWARE_CONFIG
141 user_data: { get_resource: install_config_agent}
Mateusz Lose2ad0772020-02-27 21:41:54 +0100142 metadata: { get_param: metadata }
143
144 accessible_server_port:
145 type: OS::Neutron::Port
146 properties:
147 network_id: { get_param: accessible_network }
148 port_security_enabled: false
149 fixed_ips:
150 - subnet: { get_param: accessible_subnet_id }
151
152 storage_backend_server_port:
153 type: OS::Neutron::Port
154 properties:
155 network_id: { get_param: storage_backend_network }
156 port_security_enabled: false
157 fixed_ips:
158 - subnet: { get_param: storage_backend_subnet_id }
159
160 storage_frontend_server_port:
161 type: OS::Neutron::Port
162 properties:
163 network_id: { get_param: storage_frontend_network }
164 port_security_enabled: false
165 fixed_ips:
166 - subnet: { get_param: storage_frontend_subnet_id }
167
168 private_floating_server_port:
169 type: OS::Neutron::Port
170 properties:
171 network_id: { get_param: private_floating_network }
172 port_security_enabled: false
173 fixed_ips:
174 - subnet: { get_param: private_floating_subnet_id }
175
176 server_floating_ip:
177 type: OS::Neutron::FloatingIP
178 properties:
179 floating_network_id: { get_param: public_net_id }
180 port_id: { get_resource: accessible_server_port }
181
182 wait_handle:
183 type: OS::Heat::WaitConditionHandle
184 wait_condition:
185 type: OS::Heat::WaitCondition
186 properties:
187 handle: { get_resource: wait_handle }
188 timeout: { get_param: boot_timeout }
189
190outputs:
191 server_private_ip:
192 description: IP address of server in private network
193 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
194 server_private_floating_ip:
195 description: IP address of server in private floating network
196 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
197 server_public_ip:
198 description: Floating IP address of server in public network
199 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200200 wc_data:
201 description: Metadata from instance
202 value: { get_attr: [wait_condition, data]}