blob: 3bd436913731960a184fbd1f3d6bb5131e753f11 [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_frontend_network_cidr:
32 type: string
33 storage_frontend_network:
34 type: string
35 storage_frontend_subnet_id:
36 type: string
Oleh Hryhorov1832d232020-03-05 11:33:13 +020037 storage_frontend_interface:
38 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020039 host_interface:
40 type: string
41 functions_override:
42 type: string
43 boot_timeout:
44 type: number
45 description: Boot timeout for instance
46 default: 1200
47 ucp_master_host:
48 type: string
49 default: ''
50 public_net_id:
51 type: string
52 default: ''
53 docker_ee_release:
54 type: string
55 docker_ee_url:
56 type: string
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020057 hardware_metadata:
58 description: The content of lab metadata.
59 type: string
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020060
61resources:
62
63 software_config:
64 type: OS::Heat::SoftwareConfig
65 properties:
66 group: ungrouped
67 config:
68 str_replace:
69 template: { get_file: ../scripts/instance_boot.sh }
70 params:
71 $node_type: { get_param: node_type }
72 $wait_condition_notify: { get_attr: [ wait_handle, curl_cli ] }
73 $ucp_license_key: { get_file: ../scripts/license.lic }
74 $docker_ee_url: { get_param: docker_ee_url }
75 $docker_ee_release: { get_param: docker_ee_release }
76 $ucp_master_host: { get_param: ucp_master_host }
77 $node_metadata: { get_param: metadata }
78 $host_interface: { get_param: host_interface }
79 $private_floating_interface: { get_param: private_floating_interface }
80 $private_floating_network_cidr: { get_param: private_floating_network_cidr }
81 $private_floating_interface_ip: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
82 $functions_override: { get_param: functions_override }
Oleh Hryhorov1832d232020-03-05 11:33:13 +020083 $storage_frontend_interface: { get_param: storage_frontend_interface }
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +020084 $storage_frontend_network_interface_ip: { get_attr: [storage_frontend_server_port, fixed_ips, 0, ip_address] }
85 $storage_frontend_network_cidr: { get_param: storage_frontend_network_cidr }
86
Vasyl Saienkof9ee1582020-03-02 16:53:41 +020087 inject_files:
88 type: "OS::Heat::CloudConfig"
89 properties:
90 cloud_config:
91 write_files:
92 - path: /usr/sbin/prepare-metadata.py
93 owner: "root:root"
94 permissions: "0755"
95 content: {get_file: ../scripts/prepare-metadata.py}
96 - path: /usr/share/metadata/lab-metadata.yaml
97 owner: "root:root"
98 permissions: "0644"
99 content: { get_param: hardware_metadata}
100
101 install_config_agent:
102 type: "OS::Heat::MultipartMime"
103 properties:
104 parts:
105 - config: {get_resource: software_config}
106 - config: {get_resource: inject_files}
107
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200108 server:
109 type: OS::Nova::Server
110 properties:
111 image: { get_param: image }
112 flavor: { get_param: flavor }
113 key_name: { get_param: key_name }
114 availability_zone: nova
115 networks:
116 - network: { get_param: accessible_network }
117 # NOTE(ohryhorov): connect to accessible network only as ironic doesn't
118 # support multitenancy use-case. Use private_floating_network for IPAM only.
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200119 user_data_format: SOFTWARE_CONFIG
120 user_data: { get_resource: install_config_agent}
Oleh Hryhorovdccb1cd2020-03-04 15:52:55 +0200121 metadata: { get_param: metadata }
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 storage_frontend_server_port:
132 type: OS::Neutron::Port
133 properties:
134 network_id: { get_param: storage_frontend_network }
135 port_security_enabled: false
136 fixed_ips:
137 - subnet: { get_param: storage_frontend_subnet_id }
138
139 wait_handle:
140 type: OS::Heat::WaitConditionHandle
141 wait_condition:
142 type: OS::Heat::WaitCondition
143 properties:
144 handle: { get_resource: wait_handle }
145 timeout: { get_param: boot_timeout }
146
147
148outputs:
149 server_private_ip:
150 description: IP address of server in private network
151 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
152 server_private_floating_ip:
153 description: IP address of server in private floating network
154 value: { get_attr: [private_floating_server_port, fixed_ips, 0, ip_address] }
155 server_public_ip:
156 description: Floating IP address of server in public network
157 value: { get_attr: [server, networks, { get_param: accessible_network}, 0]}
Vasyl Saienkof9ee1582020-03-02 16:53:41 +0200158 wc_data:
159 description: Metadata from instance
160 value: { get_attr: [wait_condition, data]}