blob: 6d2bbb97a0c2c82bf3a8bdcbe06d8ac54d4c8360 [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'
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020051 hardware_metadata:
52 description: The content of lab metadata.
53 default: ''
54 type: string
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020055
56resources:
57
58 software_config:
59 type: OS::Heat::SoftwareConfig
60 properties:
61 group: ungrouped
62 config:
63 str_replace:
64 template: { get_file: ../scripts/instance_boot.sh }
65 params:
66 $node_type: { get_param: node_type }
67 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020068 $docker_ee_url: { get_param: docker_ee_url }
69 $docker_ee_release: { get_param: docker_ee_release }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020070 $ucp_master_host: { get_param: ucp_master_host }
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030071 $docker_ucp_image: { get_param: docker_ucp_image }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020072 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020073 $control_network_cidr: { get_param: control_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020074 $private_floating_interface: { get_param: private_floating_interface }
75 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
Oleh Hryhorovca772092020-02-13 11:15:17 +020076 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020077 $functions_override: { get_param: functions_override }
Vasyl Saienkob59853e2020-05-25 10:15:26 +030078 $docker_ucp_image: { get_param: docker_ucp_image }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020079
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020080 inject_files:
81 type: "OS::Heat::CloudConfig"
82 properties:
83 cloud_config:
84 write_files:
85 - path: /usr/sbin/prepare-metadata.py
86 owner: "root:root"
87 permissions: "0755"
88 content: {get_file: ../scripts/prepare-metadata.py}
89 - path: /usr/share/metadata/lab-metadata.yaml
90 owner: "root:root"
91 permissions: "0644"
92 content: { get_param: hardware_metadata}
93
94 install_config_agent:
95 type: "OS::Heat::MultipartMime"
96 properties:
97 parts:
98 - config: {get_resource: software_config}
99 - config: {get_resource: inject_files}
100
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200101 server:
102 type: OS::Nova::Server
103 properties:
104 image: { get_param: image }
105 flavor: { get_param: flavor }
106 key_name: { get_param: key_name }
107 availability_zone: nova
108 networks:
109 - port: { get_resource: accessible_server_port }
110 - port: { get_resource: private_floating_server_port }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200111 user_data_format: SOFTWARE_CONFIG
112 user_data: { get_resource: install_config_agent}
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200113 metadata: { get_param: metadata }
114
115 accessible_server_port:
116 type: OS::Neutron::Port
117 properties:
118 network_id: { get_param: accessible_network }
119 port_security_enabled: false
120 fixed_ips:
121 - subnet: { get_param: accessible_subnet_id }
122
123 private_floating_server_port:
124 type: OS::Neutron::Port
125 properties:
126 network_id: { get_param: private_floating_network }
127 port_security_enabled: false
128 fixed_ips:
129 - subnet: { get_param: private_floating_subnet_id }
130
131 server_floating_ip:
132 type: OS::Neutron::FloatingIP
133 properties:
134 floating_network_id: { get_param: public_net_id }
135 port_id: { get_resource: accessible_server_port }
136
137 wait_handle:
138 type: OS::Heat::WaitConditionHandle
139 wait_condition:
140 type: OS::Heat::WaitCondition
141 properties:
142 handle: { get_resource: wait_handle }
143 timeout: { get_param: boot_timeout }
144
145outputs:
146 server_private_ip:
147 description: IP address of server in private network
148 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
149 server_private_floating_ip:
150 description: IP address of server in private floating network
151 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
152 server_public_ip:
153 description: Floating IP address of server in public network
154 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200155 wc_data:
156 description: Metadata from instance
157 value: { get_attr: [wait_condition, data]}