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