blob: ef33b58c7396aa9653e4ebd20bc3378700755e10 [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_backend_network_cidr:
32 type: string
33 storage_backend_network:
34 type: string
35 storage_backend_subnet_id:
36 type: string
37 storage_backend_interface:
38 type: string
39 storage_frontend_network:
40 type: string
41 storage_frontend_network_cidr:
42 type: string
43 storage_frontend_subnet_id:
44 type: string
45 storage_frontend_interface:
46 type: string
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020047 control_network_cidr:
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020048 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 default: ''
61 docker_ee_release:
62 type: string
63 docker_ee_url:
64 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020065 hardware_metadata:
66 description: The content of lab metadata.
67 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020068
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 }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020087 $private_floating_interface: { get_param: private_floating_interface }
88 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
89 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
90 $functions_override: { get_param: functions_override }
91 $storage_frontend_interface: { get_param: storage_frontend_interface }
92 $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 }
94 $storage_backend_interface: { get_param: storage_backend_interface }
95 $storage_backend_network_interface_ip: { get_attr: [storage_backend_server_port, fixed_ips, 0, ip_address] }
96 $storage_backend_network_cidr: { get_param: storage_backend_network_cidr }
97
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020098 inject_files:
99 type: "OS::Heat::CloudConfig"
100 properties:
101 cloud_config:
102 write_files:
103 - path: /usr/sbin/prepare-metadata.py
104 owner: "root:root"
105 permissions: "0755"
106 content: {get_file: ../scripts/prepare-metadata.py}
107 - path: /usr/share/metadata/lab-metadata.yaml
108 owner: "root:root"
109 permissions: "0644"
110 content: { get_param: hardware_metadata}
111
112 install_config_agent:
113 type: "OS::Heat::MultipartMime"
114 properties:
115 parts:
116 - config: {get_resource: software_config}
117 - config: {get_resource: inject_files}
118
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200119 server:
120 type: OS::Nova::Server
121 properties:
122 image: { get_param: image }
123 flavor: { get_param: flavor }
124 key_name: { get_param: key_name }
125 availability_zone: nova
126 networks:
127 - network: { get_param: accessible_network }
128 # NOTE(ohryhorov): connect to accessible network only as ironic doesn't
129 # support multitenancy use-case. Use private_floating_network for IPAM only.
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200130 user_data_format: SOFTWARE_CONFIG
131 user_data: { get_resource: install_config_agent}
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200132 metadata: { get_param: metadata }
133
134 private_floating_server_port:
135 type: OS::Neutron::Port
136 properties:
137 network_id: { get_param: private_floating_network }
138 port_security_enabled: false
139 fixed_ips:
140 - subnet: { get_param: private_floating_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 wait_handle:
159 type: OS::Heat::WaitConditionHandle
160 wait_condition:
161 type: OS::Heat::WaitCondition
162 properties:
163 handle: { get_resource: wait_handle }
164 timeout: { get_param: boot_timeout }
165
166
167outputs:
168 server_private_ip:
169 description: IP address of server in private network
170 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
171 server_private_floating_ip:
172 description: IP address of server in private floating network
173 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
174 server_public_ip:
175 description: Floating IP address of server in public network
176 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200177 wc_data:
178 description: Metadata from instance
179 value: { get_attr: [wait_condition, data]}