Add all isolated networks to all nodes.
[apex-tripleo-heat-templates.git] / puppet / cinder-storage.yaml
1 heat_template_version: 2015-04-30
2 description: 'OpenStack cinder storage configured by Puppet'
3 parameters:
4   Image:
5     default: overcloud-cinder-volume
6     type: string
7   CinderEnableIscsiBackend:
8     default: true
9     description: Whether to enable or not the Iscsi backend for Cinder
10     type: boolean
11   CinderISCSIHelper:
12     default: tgtadm
13     description: The iSCSI helper to use with cinder.
14     type: string
15   CinderLVMLoopDeviceSize:
16     default: 5000
17     description: The size of the loopback file used by the cinder LVM driver.
18     type: number
19   CinderPassword:
20     default: unset
21     description: The password for the cinder service and db account, used by cinder-api.
22     type: string
23     hidden: true
24   Debug:
25     default: ''
26     description: Set to True to enable debugging on all services.
27     type: string
28   VirtualIP: # deprecated. Use per service VIPs instead.
29     default: ''
30     type: string
31   ExtraConfig:
32     default: {}
33     description: |
34       Additional hiera configuration to inject into the cluster. Note
35       that BlockStorageExtraConfig takes precedence over ExtraConfig.
36     type: json
37   BlockStorageExtraConfig:
38     default: {}
39     description: |
40       Role specific additional hiera configuration to inject into the cluster.
41     type: json
42   Flavor:
43     description: Flavor for block storage nodes to request when deploying.
44     type: string
45     constraints:
46       - custom_constraint: nova.flavor
47   KeyName:
48     default: default
49     description: Name of an existing Nova key pair to enable SSH access to the instances
50     type: string
51   RabbitPassword:
52     default: 'guest'
53     type: string
54     hidden: true
55   RabbitUserName:
56     default: 'guest'
57     type: string
58   RabbitClientUseSSL:
59     default: false
60     description: >
61         Rabbit client subscriber parameter to specify
62         an SSL connection to the RabbitMQ host.
63     type: string
64   RabbitClientPort:
65     default: 5672
66     description: Set rabbit subscriber port, change this if using SSL
67     type: number
68   SnmpdReadonlyUserName:
69     default: ro_snmp_user
70     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
71     type: string
72   SnmpdReadonlyUserPassword:
73     default: unset
74     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
75     type: string
76     hidden: true
77   NtpServer:
78     default: ''
79     description: Comma-separated list of ntp servers
80     type: comma_delimited_list
81   EnablePackageInstall:
82     default: 'false'
83     description: Set to true to enable package installation via Puppet
84     type: boolean
85   UpdateIdentifier:
86     default: ''
87     type: string
88     description: >
89       Setting to a previously unused value during stack-update will trigger
90       package update on all nodes
91   Hostname:
92     type: string
93     default: '' # Defaults to Heat created hostname
94   ServiceNetMap:
95     default: {}
96     description: Mapping of service_name -> network name. Typically set
97                  via parameter_defaults in the resource registry.
98     type: json
99   EndpointMap:
100     default: {}
101     description: Mapping of service endpoint -> protocol. Typically set
102                  via parameter_defaults in the resource registry.
103     type: json
104   GlanceApiVirtualIP:
105     type: string
106     default: ''
107   MysqlVirtualIP:
108     type: string
109     default: ''
110   NetworkDeploymentActions:
111     type: comma_delimited_list
112     description: >
113       Heat action when to apply network configuration changes
114     default: ['CREATE']
115   CloudDomain:
116     default: ''
117     type: string
118     description: >
119       The DNS domain used for the hosts. This should match the dhcp_domain
120       configured in the Undercloud neutron. Defaults to localdomain.
121   ServerMetadata:
122     default: {}
123     description: >
124       Extra properties or metadata passed to Nova for the created nodes in
125       the overcloud. It's accessible via the Nova metadata API.
126     type: json
127   SchedulerHints:
128     type: json
129     description: Optional scheduler hints to pass to nova
130     default: {}
131
132
133 resources:
134   BlockStorage:
135     type: OS::Nova::Server
136     properties:
137       image:
138         {get_param: Image}
139       flavor: {get_param: Flavor}
140       key_name: {get_param: KeyName}
141       networks:
142         - network: ctlplane
143       user_data_format: SOFTWARE_CONFIG
144       user_data: {get_resource: UserData}
145       name: {get_param: Hostname}
146       metadata: {get_param: ServerMetadata}
147       scheduler_hints: {get_param: SchedulerHints}
148
149   # Combine the NodeAdminUserData and NodeUserData mime archives
150   UserData:
151     type: OS::Heat::MultipartMime
152     properties:
153       parts:
154       - config: {get_resource: NodeAdminUserData}
155         type: multipart
156       - config: {get_resource: NodeUserData}
157         type: multipart
158
159   # Creates the "heat-admin" user if configured via the environment
160   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
161   NodeAdminUserData:
162     type: OS::TripleO::NodeAdminUserData
163
164   # For optional operator additional userdata
165   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
166   NodeUserData:
167     type: OS::TripleO::NodeUserData
168
169   ExternalPort:
170     type: OS::TripleO::BlockStorage::Ports::ExternalPort
171     properties:
172       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
173
174   InternalApiPort:
175     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
176     properties:
177       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
178
179   StoragePort:
180     type: OS::TripleO::BlockStorage::Ports::StoragePort
181     properties:
182       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
183
184   StorageMgmtPort:
185     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
186     properties:
187       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
188
189   TenantPort:
190     type: OS::TripleO::BlockStorage::Ports::TenantPort
191     properties:
192       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
193
194   ManagementPort:
195     type: OS::TripleO::BlockStorage::Ports::ManagementPort
196     properties:
197       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
198
199   NetworkConfig:
200     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
201     properties:
202       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
203       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
204       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
205       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
206       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
207       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
208       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
209
210   NetIpMap:
211     type: OS::TripleO::Network::Ports::NetIpMap
212     properties:
213       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
214       ExternalIp: {get_attr: [ExternalPort, ip_address]}
215       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
216       StorageIp: {get_attr: [StoragePort, ip_address]}
217       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
218       TenantIp: {get_attr: [TenantPort, ip_address]}
219       ManagementIp: {get_attr: [ManagementPort, ip_address]}
220
221   NetworkDeployment:
222     type: OS::TripleO::SoftwareDeployment
223     properties:
224       config: {get_resource: NetworkConfig}
225       server: {get_resource: BlockStorage}
226       actions: {get_param: NetworkDeploymentActions}
227
228   BlockStorageDeployment:
229     type: OS::Heat::StructuredDeployment
230     depends_on: NetworkDeployment
231     properties:
232       server: {get_resource: BlockStorage}
233       config: {get_resource: BlockStorageConfig}
234       input_values:
235         debug: {get_param: Debug}
236         cinder_dsn: {list_join: ['', ['mysql://cinder:', {get_param: CinderPassword}, '@', {get_param: MysqlVirtualIP} , '/cinder']]}
237         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
238         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
239         cinder_lvm_loop_device_size:
240           str_replace:
241             template: sizeM
242             params:
243               size: {get_param: CinderLVMLoopDeviceSize}
244         cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
245         cinder_iscsi_helper: {get_param: CinderISCSIHelper}
246         cinder_iscsi_ip_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
247         glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]}
248         rabbit_username: {get_param: RabbitUserName}
249         rabbit_password: {get_param: RabbitPassword}
250         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
251         rabbit_client_port: {get_param: RabbitClientPort}
252         ntp_servers: {get_param: NtpServer}
253         enable_package_install: {get_param: EnablePackageInstall}
254         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
255
256   # Map heat metadata into hiera datafiles
257   BlockStorageConfig:
258     type: OS::Heat::StructuredConfig
259     properties:
260       group: os-apply-config
261       config:
262         hiera:
263           hierarchy:
264             - '"%{::uuid}"'
265             - heat_config_%{::deploy_config_name}
266             - volume_extraconfig
267             - extraconfig
268             - volume
269             - all_nodes # provided by allNodesConfig
270             - '"%{::osfamily}"'
271             - common
272           datafiles:
273             common:
274               raw_data: {get_file: hieradata/common.yaml}
275             volume_extraconfig:
276               mapped_data: {get_param: BlockStorageExtraConfig}
277             extraconfig:
278               mapped_data: {get_param: ExtraConfig}
279             volume:
280               raw_data: {get_file: hieradata/volume.yaml}
281               mapped_data:
282                 # Cinder
283                 cinder::debug: {get_input: debug}
284                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
285                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
286                 cinder::database_connection: {get_input: cinder_dsn}
287                 cinder::rabbit_userid: {get_input: rabbit_username}
288                 cinder::rabbit_password: {get_input: rabbit_password}
289                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
290                 cinder::rabbit_port: {get_input: rabbit_client_port}
291                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
292                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
293                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
294                 ntp::servers: {get_input: ntp_servers}
295                 tripleo::packages::enable_install: {get_input: enable_package_install}
296                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
297                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
298                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
299
300   # Resource for site-specific injection of root certificate
301   NodeTLSCAData:
302     depends_on: BlockStorageDeployment
303     type: OS::TripleO::NodeTLSCAData
304     properties:
305       server: {get_resource: BlockStorage}
306
307   # Hook for site-specific additional pre-deployment config,
308   # applying to all nodes, e.g node registration/unregistration
309   NodeExtraConfig:
310     depends_on: NodeTLSCAData
311     type: OS::TripleO::NodeExtraConfig
312     properties:
313         server: {get_resource: BlockStorage}
314
315   UpdateConfig:
316     type: OS::TripleO::Tasks::PackageUpdate
317
318   UpdateDeployment:
319     type: OS::Heat::SoftwareDeployment
320     properties:
321       config: {get_resource: UpdateConfig}
322       server: {get_resource: BlockStorage}
323       input_values:
324         update_identifier:
325           get_param: UpdateIdentifier
326
327 outputs:
328   hosts_entry:
329     value:
330       str_replace:
331         template: "IP HOST.DOMAIN HOST"
332         params:
333           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
334           DOMAIN: {get_param: CloudDomain}
335           HOST: {get_attr: [BlockStorage, name]}
336   nova_server_resource:
337     description: Heat resource handle for the block storage server
338     value:
339       {get_resource: BlockStorage}
340   external_ip_address:
341     description: IP address of the server in the external network
342     value: {get_attr: [ExternalPort, ip_address]}
343   internal_api_ip_address:
344     description: IP address of the server in the internal_api network
345     value: {get_attr: [InternalApiPort, ip_address]}
346   storage_ip_address:
347     description: IP address of the server in the storage network
348     value: {get_attr: [StoragePort, ip_address]}
349   storage_mgmt_ip_address:
350     description: IP address of the server in the storage_mgmt network
351     value: {get_attr: [StorageMgmtPort, ip_address]}
352   tenant_ip_address:
353     description: IP address of the server in the tenant network
354     value: {get_attr: [TenantPort, ip_address]}
355   management_ip_address:
356     description: IP address of the server in the management network
357     value: {get_attr: [ManagementPort, ip_address]}
358   config_identifier:
359     description: identifier which changes if the node configuration may need re-applying
360     value:
361       list_join:
362         - ''
363         - - {get_attr: [BlockStorageDeployment, deploy_stdout]}
364           - {get_attr: [NodeTLSCAData, deploy_stdout]}
365           - {get_param: UpdateIdentifier}