blob: fbedc7109fce6e54a0ac066a30da3384f617aa33 [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
31 host_interface:
32 type: string
33 functions_override:
34 type: string
35 boot_timeout:
36 type: number
37 description: Boot timeout for instance
38 default: 1200
39 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 Saienkof9ee1582020-03-02 16:53:41 +020048 hardware_metadata:
49 description: The content of lab metadata.
50 default: ''
51 type: string
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020052
53resources:
54
55 software_config:
56 type: OS::Heat::SoftwareConfig
57 properties:
58 group: ungrouped
59 config:
60 str_replace:
61 template: { get_file: ../scripts/instance_boot.sh }
62 params:
63 $node_type: { get_param: node_type }
64 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
65 $ucp_license_key: { get_file: ../scripts/license.lic }
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020066 $docker_ee_url: { get_param: docker_ee_url }
67 $docker_ee_release: { get_param: docker_ee_release }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020068 $ucp_master_host: { get_param: ucp_master_host }
69 $node_metadata: { get_param: metadata }
70 $host_interface: { get_param: host_interface }
71 $private_floating_interface: { get_param: private_floating_interface }
72 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
Oleh Hryhorovca772092020-02-13 11:15:17 +020073 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020074 $functions_override: { get_param: functions_override }
75
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020076 inject_files:
77 type: "OS::Heat::CloudConfig"
78 properties:
79 cloud_config:
80 write_files:
81 - path: /usr/sbin/prepare-metadata.py
82 owner: "root:root"
83 permissions: "0755"
84 content: {get_file: ../scripts/prepare-metadata.py}
85 - path: /usr/share/metadata/lab-metadata.yaml
86 owner: "root:root"
87 permissions: "0644"
88 content: { get_param: hardware_metadata}
89
90 install_config_agent:
91 type: "OS::Heat::MultipartMime"
92 properties:
93 parts:
94 - config: {get_resource: software_config}
95 - config: {get_resource: inject_files}
96
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020097 server:
98 type: OS::Nova::Server
99 properties:
100 image: { get_param: image }
101 flavor: { get_param: flavor }
102 key_name: { get_param: key_name }
103 availability_zone: nova
104 networks:
105 - port: { get_resource: accessible_server_port }
106 - port: { get_resource: private_floating_server_port }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200107 user_data_format: SOFTWARE_CONFIG
108 user_data: { get_resource: install_config_agent}
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200109 metadata: { get_param: metadata }
110
111 accessible_server_port:
112 type: OS::Neutron::Port
113 properties:
114 network_id: { get_param: accessible_network }
115 port_security_enabled: false
116 fixed_ips:
117 - subnet: { get_param: accessible_subnet_id }
118
119 private_floating_server_port:
120 type: OS::Neutron::Port
121 properties:
122 network_id: { get_param: private_floating_network }
123 port_security_enabled: false
124 fixed_ips:
125 - subnet: { get_param: private_floating_subnet_id }
126
127 server_floating_ip:
128 type: OS::Neutron::FloatingIP
129 properties:
130 floating_network_id: { get_param: public_net_id }
131 port_id: { get_resource: accessible_server_port }
132
133 wait_handle:
134 type: OS::Heat::WaitConditionHandle
135 wait_condition:
136 type: OS::Heat::WaitCondition
137 properties:
138 handle: { get_resource: wait_handle }
139 timeout: { get_param: boot_timeout }
140
141outputs:
142 server_private_ip:
143 description: IP address of server in private network
144 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
145 server_private_floating_ip:
146 description: IP address of server in private floating network
147 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
148 server_public_ip:
149 description: Floating IP address of server in public network
150 value: { get_attr: [ server_floating_ip, floating_ip_address ] }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200151 wc_data:
152 description: Metadata from instance
153 value: { get_attr: [wait_condition, data]}