blob: ad401ccdbd2b552a19459e953c9e6e9f27201e68 [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
Mateusz Lose2ad0772020-02-27 21:41:54 +010059
60resources:
61
62 software_config:
63 type: OS::Heat::SoftwareConfig
64 properties:
65 group: ungrouped
66 config:
67 str_replace:
68 template: { get_file: ../scripts/instance_boot.sh }
69 params:
70 $node_type: { get_param: node_type }
71 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
72 $ucp_license_key: { get_file: ../scripts/license.lic }
73 $docker_ee_url: { get_param: docker_ee_url }
74 $docker_ee_release: { get_param: docker_ee_release }
75 $ucp_master_host: { get_param: ucp_master_host }
76 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020077 $control_network_cidr: { get_param: control_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010078 $private_floating_interface: { get_param: private_floating_interface }
79 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
80 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
81 $functions_override: { get_param: functions_override }
Oleh Hryhorov1832d232020-03-05 11:33:13 +020082 $storage_frontend_interface: { get_param: storage_frontend_interface }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020083 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
84 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
Mateusz Lose2ad0772020-02-27 21:41:54 +010085
Oleh Hryhorov6cd21902020-03-05 18:29:31 +020086 inject_files:
87 type: "OS::Heat::CloudConfig"
88 properties:
89 cloud_config:
90 write_files:
91 - path: /usr/sbin/prepare-metadata.py
92 owner: "root:root"
93 permissions: "0755"
94 content: {get_file: ../scripts/prepare-metadata.py}
95 - path: /usr/share/metadata/lab-metadata.yaml
96 owner: "root:root"
97 permissions: "0644"
98 content: { get_param: hardware_metadata}
99
100 install_config_agent:
101 type: "OS::Heat::MultipartMime"
102 properties:
103 parts:
104 - config: {get_resource: software_config}
105 - config: {get_resource: inject_files}
106
Mateusz Lose2ad0772020-02-27 21:41:54 +0100107 server:
108 type: OS::Nova::Server
109 properties:
110 image: { get_param: image }
111 flavor: { get_param: flavor }
112 key_name: { get_param: key_name }
113 availability_zone: nova
114 networks:
115 - port: { get_resource: accessible_server_port }
116 - port: { get_resource: private_floating_server_port }
117 - port: { get_resource: storage_frontend_server_port }
Oleh Hryhorov6cd21902020-03-05 18:29:31 +0200118 user_data_format: SOFTWARE_CONFIG
119 user_data: { get_resource: install_config_agent}
Mateusz Lose2ad0772020-02-27 21:41:54 +0100120 metadata: { get_param: metadata }
121
122 accessible_server_port:
123 type: OS::Neutron::Port
124 properties:
125 network_id: { get_param: accessible_network }
126 port_security_enabled: false
127 fixed_ips:
128 - subnet: { get_param: accessible_subnet_id }
129
130 storage_frontend_server_port:
131 type: OS::Neutron::Port
132 properties:
133 network_id: { get_param: storage_frontend_network }
134 port_security_enabled: false
135 fixed_ips:
136 - subnet: { get_param: storage_frontend_subnet_id }
137
138 private_floating_server_port:
139 type: OS::Neutron::Port
140 properties:
141 network_id: { get_param: private_floating_network }
142 port_security_enabled: false
143 fixed_ips:
144 - subnet: { get_param: private_floating_subnet_id }
145
146 server_floating_ip:
147 type: OS::Neutron::FloatingIP
148 properties:
149 floating_network_id: { get_param: public_net_id }
150 port_id: { get_resource: accessible_server_port }
151
152 wait_handle:
153 type: OS::Heat::WaitConditionHandle
154 wait_condition:
155 type: OS::Heat::WaitCondition
156 properties:
157 handle: { get_resource: wait_handle }
158 timeout: { get_param: boot_timeout }
159
160outputs:
161 server_private_ip:
162 description: IP address of server in private network
163 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
164 server_private_floating_ip:
165 description: IP address of server in private floating network
166 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
167 server_public_ip:
168 description: Floating IP address of server in public network
169 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200170 wc_data:
171 description: Metadata from instance
172 value: { get_attr: [wait_condition, data]}