blob: dce451e06b04898bb1505589e004c28a67183eb3 [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_frontend_network_cidr:
32 type: string
Mateusz Lose2ad0772020-02-27 21:41:54 +010033 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:
Mateusz Lose2ad0772020-02-27 21:41:54 +010040 type: string
41 functions_override:
42 type: string
43 boot_timeout:
44 type: number
45 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020046 default: 3600
Mateusz Lose2ad0772020-02-27 21:41:54 +010047 ucp_master_host:
48 type: string
49 default: ''
50 public_net_id:
51 type: string
52 docker_ee_release:
53 type: string
54 docker_ee_url:
55 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020056 hardware_metadata:
57 description: The content of lab metadata.
58 type: string
Oleh Hryhorov33e30e22020-03-12 11:51:40 +020059 user_data_config:
60 description: This is part of clout-config which denies to mount drive with label ephemeral0 to /mnt
61 type: string
62 default: |
63 #cloud-config
64 #
65 # Don't mount ephemeral0 to /mnt as it's by default
66 mounts:
67 - [ ephemeral0, null ]
Mateusz Lose2ad0772020-02-27 21:41:54 +010068
69resources:
70
71 software_config:
72 type: OS::Heat::SoftwareConfig
73 properties:
74 group: ungrouped
75 config:
76 str_replace:
77 template: { get_file: ../scripts/instance_boot.sh }
78 params:
79 $node_type: { get_param: node_type }
80 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
81 $ucp_license_key: { get_file: ../scripts/license.lic }
82 $docker_ee_url: { get_param: docker_ee_url }
83 $docker_ee_release: { get_param: docker_ee_release }
84 $ucp_master_host: { get_param: ucp_master_host }
85 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020086 $control_network_cidr: { get_param: control_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010087 $private_floating_interface: { get_param: private_floating_interface }
88 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
89 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
90 $functions_override: { get_param: functions_override }
Oleh Hryhorov1832d232020-03-05 11:33:13 +020091 $storage_frontend_interface: { get_param: storage_frontend_interface }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020092 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
93 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010094
Oleh Hryhorov6cd21902020-03-05 18:29:31 +020095 inject_files:
96 type: "OS::Heat::CloudConfig"
97 properties:
98 cloud_config:
99 write_files:
100 - path: /usr/sbin/prepare-metadata.py
101 owner: "root:root"
102 permissions: "0755"
103 content: {get_file: ../scripts/prepare-metadata.py}
104 - path: /usr/share/metadata/lab-metadata.yaml
105 owner: "root:root"
106 permissions: "0644"
107 content: { get_param: hardware_metadata}
108
109 install_config_agent:
110 type: "OS::Heat::MultipartMime"
111 properties:
112 parts:
113 - config: {get_resource: software_config}
114 - config: {get_resource: inject_files}
Oleh Hryhorov33e30e22020-03-12 11:51:40 +0200115 - config: {get_param: user_data_config}
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200116
Mateusz Lose2ad0772020-02-27 21:41:54 +0100117 server:
118 type: OS::Nova::Server
119 properties:
120 image: { get_param: image }
121 flavor: { get_param: flavor }
122 key_name: { get_param: key_name }
123 availability_zone: nova
124 networks:
125 - port: { get_resource: accessible_server_port }
126 - port: { get_resource: private_floating_server_port }
127 - port: { get_resource: storage_frontend_server_port }
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200128 user_data_format: SOFTWARE_CONFIG
129 user_data: { get_resource: install_config_agent}
Mateusz Lose2ad0772020-02-27 21:41:54 +0100130 metadata: { get_param: metadata }
131
132 accessible_server_port:
133 type: OS::Neutron::Port
134 properties:
135 network_id: { get_param: accessible_network }
136 port_security_enabled: false
137 fixed_ips:
138 - subnet: { get_param: accessible_subnet_id }
139
140 storage_frontend_server_port:
141 type: OS::Neutron::Port
142 properties:
143 network_id: { get_param: storage_frontend_network }
144 port_security_enabled: false
145 fixed_ips:
146 - subnet: { get_param: storage_frontend_subnet_id }
147
148 private_floating_server_port:
149 type: OS::Neutron::Port
150 properties:
151 network_id: { get_param: private_floating_network }
152 port_security_enabled: false
153 fixed_ips:
154 - subnet: { get_param: private_floating_subnet_id }
155
156 server_floating_ip:
157 type: OS::Neutron::FloatingIP
158 properties:
159 floating_network_id: { get_param: public_net_id }
160 port_id: { get_resource: accessible_server_port }
161
162 wait_handle:
163 type: OS::Heat::WaitConditionHandle
164 wait_condition:
165 type: OS::Heat::WaitCondition
166 properties:
167 handle: { get_resource: wait_handle }
168 timeout: { get_param: boot_timeout }
169
170outputs:
171 server_private_ip:
172 description: IP address of server in private network
173 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
174 server_private_floating_ip:
175 description: IP address of server in private floating network
176 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
177 server_public_ip:
178 description: Floating IP address of server in public network
179 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200180 wc_data:
181 description: Metadata from instance
182 value: { get_attr: [wait_condition, data]}