blob: f373ea93ee5095bf9198abdb954d6b499e81c0f9 [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
54 default: 1200
55 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
Mateusz Lose2ad0772020-02-27 21:41:54 +010067
68resources:
69
70 software_config:
71 type: OS::Heat::SoftwareConfig
72 properties:
73 group: ungrouped
74 config:
75 str_replace:
76 template: { get_file: ../scripts/instance_boot.sh }
77 params:
78 $node_type: { get_param: node_type }
79 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
80 $ucp_license_key: { get_file: ../scripts/license.lic }
81 $docker_ee_url: { get_param: docker_ee_url }
82 $docker_ee_release: { get_param: docker_ee_release }
83 $ucp_master_host: { get_param: ucp_master_host }
84 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020085 $control_network_cidr: { get_param: control_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010086 $private_floating_interface: { get_param: private_floating_interface }
87 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
88 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
89 $functions_override: { get_param: functions_override }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020090 $storage_frontend_interface: { get_param: storage_frontend_interface }
91 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
92 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
93 $storage_backend_interface: { get_param: storage_backend_interface }
94 $storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
95 $storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010096
Oleh Hryhorov6cd21902020-03-05 18:29:31 +020097 inject_files:
98 type: "OS::Heat::CloudConfig"
99 properties:
100 cloud_config:
101 write_files:
102 - path: /usr/sbin/prepare-metadata.py
103 owner: "root:root"
104 permissions: "0755"
105 content: {get_file: ../scripts/prepare-metadata.py}
106 - path: /usr/share/metadata/lab-metadata.yaml
107 owner: "root:root"
108 permissions: "0644"
109 content: { get_param: hardware_metadata}
110
111 install_config_agent:
112 type: "OS::Heat::MultipartMime"
113 properties:
114 parts:
115 - config: {get_resource: software_config}
116 - config: {get_resource: inject_files}
117
Mateusz Lose2ad0772020-02-27 21:41:54 +0100118 server:
119 type: OS::Nova::Server
120 properties:
121 image: { get_param: image }
122 flavor: { get_param: flavor }
123 key_name: { get_param: key_name }
124 availability_zone: nova
125 networks:
126 - port: { get_resource: accessible_server_port }
127 - port: { get_resource: private_floating_server_port }
Mateusz Lose2ad0772020-02-27 21:41:54 +0100128 - port: { get_resource: storage_frontend_server_port }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200129 - port: { get_resource: storage_backend_server_port }
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200130 user_data_format: SOFTWARE_CONFIG
131 user_data: { get_resource: install_config_agent}
Mateusz Lose2ad0772020-02-27 21:41:54 +0100132 metadata: { get_param: metadata }
133
134 accessible_server_port:
135 type: OS::Neutron::Port
136 properties:
137 network_id: { get_param: accessible_network }
138 port_security_enabled: false
139 fixed_ips:
140 - subnet: { get_param: accessible_subnet_id }
141
142 storage_backend_server_port:
143 type: OS::Neutron::Port
144 properties:
145 network_id: { get_param: storage_backend_network }
146 port_security_enabled: false
147 fixed_ips:
148 - subnet: { get_param: storage_backend_subnet_id }
149
150 storage_frontend_server_port:
151 type: OS::Neutron::Port
152 properties:
153 network_id: { get_param: storage_frontend_network }
154 port_security_enabled: false
155 fixed_ips:
156 - subnet: { get_param: storage_frontend_subnet_id }
157
158 private_floating_server_port:
159 type: OS::Neutron::Port
160 properties:
161 network_id: { get_param: private_floating_network }
162 port_security_enabled: false
163 fixed_ips:
164 - subnet: { get_param: private_floating_subnet_id }
165
166 server_floating_ip:
167 type: OS::Neutron::FloatingIP
168 properties:
169 floating_network_id: { get_param: public_net_id }
170 port_id: { get_resource: accessible_server_port }
171
172 wait_handle:
173 type: OS::Heat::WaitConditionHandle
174 wait_condition:
175 type: OS::Heat::WaitCondition
176 properties:
177 handle: { get_resource: wait_handle }
178 timeout: { get_param: boot_timeout }
179
180outputs:
181 server_private_ip:
182 description: IP address of server in private network
183 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
184 server_private_floating_ip:
185 description: IP address of server in private floating network
186 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
187 server_public_ip:
188 description: Floating IP address of server in public network
189 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200190 wc_data:
191 description: Metadata from instance
192 value: { get_attr: [wait_condition, data]}