blob: 563f76f300ed524e9dff31c6948ce2584432a929 [file] [log] [blame]
Oleh Hryhorovb58460e2020-02-05 15:53:48 +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
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020031 control_network_cidr:
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020032 type: string
33 functions_override:
34 type: string
35 boot_timeout:
36 type: number
37 description: Boot timeout for instance
Vasyl Saienkof36f39c2020-03-10 00:21:42 +020038 default: 3600
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020039 ucp_master_host:
40 type: string
41 default: ''
42 public_net_id:
43 type: string
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020044 docker_ee_release:
45 type: string
46 docker_ee_url:
47 type: string
Vasyl Saienkob59853e2020-05-25 10:15:26 +030048 docker_ucp_image:
49 type: string
50 default: 'docker/ucp:3.2.4'
Stepan Rogov60bc3522020-12-16 17:43:25 +030051 docker_default_address_pool:
52 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020053 hardware_metadata:
54 description: The content of lab metadata.
55 default: ''
56 type: string
Oleh Hryhorov43bbc8c2020-12-03 15:30:09 +020057 single_node:
58 type: string
Oleh Hryhorovcd1a3bd2020-12-04 13:21:06 +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 ]
Oleh Hryhorovb58460e2020-02-05 15:53:48 +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 ] }
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020081 $docker_ee_url: { get_param: docker_ee_url }
82 $docker_ee_release: { get_param: docker_ee_release }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020083 $ucp_master_host: { get_param: ucp_master_host }
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030084 $docker_ucp_image: { get_param: docker_ucp_image }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020085 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020086 $control_network_cidr: { get_param: control_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020087 $private_floating_interface: { get_param: private_floating_interface }
88 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
Oleh Hryhorovca772092020-02-13 11:15:17 +020089 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020090 $functions_override: { get_param: functions_override }
Vasyl Saienkob59853e2020-05-25 10:15:26 +030091 $docker_ucp_image: { get_param: docker_ucp_image }
Stepan Rogov60bc3522020-12-16 17:43:25 +030092 $docker_default_address_pool: { get_param: docker_default_address_pool }
Oleh Hryhorov43bbc8c2020-12-03 15:30:09 +020093 $single_node: { get_param: single_node }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020094
Vasyl Saienkof9ee1582020-03-02 16:53:41 +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 Hryhorovcd1a3bd2020-12-04 13:21:06 +0200115 - config: {get_param: user_data_config}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200116
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200117 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 }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200127 user_data_format: SOFTWARE_CONFIG
128 user_data: { get_resource: install_config_agent}
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200129 metadata: { get_param: metadata }
130
131 accessible_server_port:
132 type: OS::Neutron::Port
133 properties:
134 network_id: { get_param: accessible_network }
135 port_security_enabled: false
136 fixed_ips:
137 - subnet: { get_param: accessible_subnet_id }
138
139 private_floating_server_port:
140 type: OS::Neutron::Port
141 properties:
142 network_id: { get_param: private_floating_network }
143 port_security_enabled: false
144 fixed_ips:
145 - subnet: { get_param: private_floating_subnet_id }
146
147 server_floating_ip:
148 type: OS::Neutron::FloatingIP
149 properties:
150 floating_network_id: { get_param: public_net_id }
151 port_id: { get_resource: accessible_server_port }
152
153 wait_handle:
154 type: OS::Heat::WaitConditionHandle
155 wait_condition:
156 type: OS::Heat::WaitCondition
157 properties:
158 handle: { get_resource: wait_handle }
159 timeout: { get_param: boot_timeout }
160
161outputs:
162 server_private_ip:
163 description: IP address of server in private network
164 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
165 server_private_floating_ip:
166 description: IP address of server in private floating network
Oleh Hryhorovcd1a3bd2020-12-04 13:21:06 +0200167 value: [ { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] } ]
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200168 server_public_ip:
169 description: Floating IP address of server in public network
170 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200171 wc_data:
172 description: Metadata from instance
173 value: { get_attr: [wait_condition, data]}