blob: bea8d126066eeed43916c8685b4e3afabfe5419d [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_frontend_network_cidr:
32 type: string
33 storage_frontend_network:
34 type: string
35 storage_frontend_subnet_id:
36 type: string
Oleh Hryhorov1832d232020-03-05 11:33:13 +020037 storage_frontend_interface:
38 type: string
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020039 control_network_cidr:
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020040 type: string
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030041 ironic_baremetal_network:
42 type: string
43 ironic_baremetal_subnet_id:
44 type: string
Vasyl Saienko4c468192020-05-19 11:51:13 +030045 ironic_baremetal_network_cidr:
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030046 type: string
Michael Polenchuk486cadf2020-08-24 16:25:51 +040047 ironic_baremetal_tunnel_cidr:
48 type: string
49 ironic_mt_enabled:
50 type: boolean
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020051 functions_override:
52 type: string
53 boot_timeout:
54 type: number
55 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020056 default: 3600
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020057 ucp_master_host:
58 type: string
59 default: ''
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030060 docker_ucp_image:
61 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020062 public_net_id:
63 type: string
64 default: ''
65 docker_ee_release:
66 type: string
67 docker_ee_url:
68 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020069 hardware_metadata:
70 description: The content of lab metadata.
71 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020072
73resources:
74
75 software_config:
76 type: OS::Heat::SoftwareConfig
77 properties:
78 group: ungrouped
79 config:
80 str_replace:
81 template: { get_file: ../scripts/instance_boot.sh }
82 params:
83 $node_type: { get_param: node_type }
84 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020085 $docker_ee_url: { get_param: docker_ee_url }
86 $docker_ee_release: { get_param: docker_ee_release }
87 $ucp_master_host: { get_param: ucp_master_host }
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030088 $docker_ucp_image: { get_param: docker_ucp_image }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020089 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020090 $control_network_cidr: { get_param: control_network_cidr }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020091 $private_floating_interface: { get_param: private_floating_interface }
92 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
93 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
94 $functions_override: { get_param: functions_override }
Oleh Hryhorov1832d232020-03-05 11:33:13 +020095 $storage_frontend_interface: { get_param: storage_frontend_interface }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020096 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
97 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
Vasyl Saienko36f2edf2020-05-14 10:44:52 +030098 $ironic_baremetal_interface_ip: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
Vasyl Saienko4c468192020-05-19 11:51:13 +030099 $ironic_baremetal_network_cidr: { get_param: ironic_baremetal_network_cidr }
Michael Polenchuk486cadf2020-08-24 16:25:51 +0400100 $ironic_baremetal_tunnel_cidr: { get_param: ironic_baremetal_tunnel_cidr }
101 $ironic_mt_enabled: { get_param: ironic_mt_enabled }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200102
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200103 inject_files:
104 type: "OS::Heat::CloudConfig"
105 properties:
106 cloud_config:
107 write_files:
108 - path: /usr/sbin/prepare-metadata.py
109 owner: "root:root"
110 permissions: "0755"
111 content: {get_file: ../scripts/prepare-metadata.py}
112 - path: /usr/share/metadata/lab-metadata.yaml
113 owner: "root:root"
114 permissions: "0644"
115 content: { get_param: hardware_metadata}
116
117 install_config_agent:
118 type: "OS::Heat::MultipartMime"
119 properties:
120 parts:
121 - config: {get_resource: software_config}
122 - config: {get_resource: inject_files}
123
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200124 server:
125 type: OS::Nova::Server
126 properties:
127 image: { get_param: image }
128 flavor: { get_param: flavor }
129 key_name: { get_param: key_name }
130 availability_zone: nova
131 networks:
132 - network: { get_param: accessible_network }
133 # NOTE(ohryhorov): connect to accessible network only as ironic doesn't
134 # support multitenancy use-case. Use private_floating_network for IPAM only.
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300135 # NOTE(vsaienko): ditto about ironic baremetal network
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200136 user_data_format: SOFTWARE_CONFIG
137 user_data: { get_resource: install_config_agent}
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200138 metadata: { get_param: metadata }
139
140 private_floating_server_port:
141 type: OS::Neutron::Port
142 properties:
143 network_id: { get_param: private_floating_network }
144 port_security_enabled: false
145 fixed_ips:
146 - subnet: { get_param: private_floating_subnet_id }
147
148 storage_frontend_server_port:
149 type: OS::Neutron::Port
150 properties:
151 network_id: { get_param: storage_frontend_network }
152 port_security_enabled: false
153 fixed_ips:
154 - subnet: { get_param: storage_frontend_subnet_id }
155
Vasyl Saienko36f2edf2020-05-14 10:44:52 +0300156 ironic_baremetal_server_port:
157 type: OS::Neutron::Port
158 properties:
159 network_id: { get_param: ironic_baremetal_network }
160 port_security_enabled: false
161 fixed_ips:
162 - subnet: { get_param: ironic_baremetal_subnet_id }
163
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200164 wait_handle:
165 type: OS::Heat::WaitConditionHandle
166 wait_condition:
167 type: OS::Heat::WaitCondition
168 properties:
169 handle: { get_resource: wait_handle }
170 timeout: { get_param: boot_timeout }
171
172
173outputs:
174 server_private_ip:
175 description: IP address of server in private network
176 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
177 server_private_floating_ip:
178 description: IP address of server in private floating network
179 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
Vasyl Saienko4e3f4632020-05-26 14:43:09 +0300180 server_ironic_baremetal_ip:
181 description: IP address of server in ironic baremetal network
182 value: { get_attr: [ironic_baremetal_server_port, fixed_ips, 0, ip_address] }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200183 server_public_ip:
184 description: Floating IP address of server in public network
185 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200186 wc_data:
187 description: Metadata from instance
188 value: { get_attr: [wait_condition, data]}