blob: 44941948ef0c5d832e8a5fd648a8e7feddadc455 [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
44 default: ''
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020045 docker_ee_release:
46 type: string
47 docker_ee_url:
48 type: string
Vasyl Saienkob59853e2020-05-25 10:15:26 +030049 docker_ucp_image:
50 type: string
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 Hryhorovb58460e2020-02-05 15:53:48 +020057
58resources:
59
60 software_config:
61 type: OS::Heat::SoftwareConfig
62 properties:
63 group: ungrouped
64 config:
65 str_replace:
66 template: { get_file: ../scripts/instance_boot.sh }
67 params:
68 $node_type: { get_param: node_type }
69 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
Mykyta Karpin5ed5fd82020-01-27 18:23:29 +020070 $docker_ee_url: { get_param: docker_ee_url }
71 $docker_ee_release: { get_param: docker_ee_release }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020072 $ucp_master_host: { get_param: ucp_master_host }
Vasyl Saienko84ee4fd2020-09-02 10:00:18 +030073 $docker_ucp_image: { get_param: docker_ucp_image }
Stepan Rogov60bc3522020-12-16 17:43:25 +030074 $docker_default_address_pool: { get_param: docker_default_address_pool }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020075 $node_metadata: { get_param: metadata }
Vasyl Saienko0fa6f192020-03-06 16:08:51 +020076 $control_network_cidr: { get_param: control_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020077 $private_floating_interface: { get_param: private_floating_interface }
Oleh Hryhorovca772092020-02-13 11:15:17 +020078 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
Oleh Hryhorovb58460e2020-02-05 15:53:48 +020079 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
80 $functions_override: { get_param: functions_override }
81
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020082 inject_files:
83 type: "OS::Heat::CloudConfig"
84 properties:
85 cloud_config:
86 write_files:
87 - path: /usr/sbin/prepare-metadata.py
88 owner: "root:root"
89 permissions: "0755"
90 content: {get_file: ../scripts/prepare-metadata.py}
91 - path: /usr/share/metadata/lab-metadata.yaml
92 owner: "root:root"
93 permissions: "0644"
94 content: { get_param: hardware_metadata}
95
96 install_config_agent:
97 type: "OS::Heat::MultipartMime"
98 properties:
99 parts:
100 - config: {get_resource: software_config}
101 - config: {get_resource: inject_files}
102
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200103 server:
104 type: OS::Nova::Server
105 properties:
Mykyta Karpin8b164562021-03-19 15:20:23 +0200106 config_drive: true
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200107 image: { get_param: image }
108 flavor: { get_param: flavor }
109 key_name: { get_param: key_name }
110 availability_zone: nova
111 networks:
112 - network: { get_param: accessible_network }
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200113 user_data_format: SOFTWARE_CONFIG
114 user_data: { get_resource: install_config_agent}
Oleh Hryhorovb58460e2020-02-05 15:53:48 +0200115 metadata: { get_param: metadata }
116
117 private_floating_server_port:
118 type: OS::Neutron::Port
119 properties:
120 network_id: { get_param: private_floating_network }
121 port_security_enabled: false
122 fixed_ips:
123 - subnet: { get_param: private_floating_subnet_id }
124
125 wait_handle:
126 type: OS::Heat::WaitConditionHandle
127 wait_condition:
128 type: OS::Heat::WaitCondition
129 properties:
130 handle: { get_resource: wait_handle }
131 timeout: { get_param: boot_timeout }
132
133
134outputs:
135 server_private_ip:
136 description: IP address of server in private network
137 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
138 server_private_floating_ip:
139 description: IP address of server in private floating network
140 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
141 server_public_ip:
142 description: Floating IP address of server in public network
143 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200144 wc_data:
145 description: Metadata from instance
146 value: { get_attr: [wait_condition, data]}