Merge "Add Management Network For System Administration."
[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     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   GlanceApiVirtualIP:
103     type: string
104     default: ''
105   MysqlVirtualIP:
106     type: string
107     default: ''
108   NetworkDeploymentActions:
109     type: comma_delimited_list
110     description: >
111       Heat action when to apply network configuration changes
112     default: ['CREATE']
113   SoftwareConfigTransport:
114     default: POLL_SERVER_CFN
115     description: |
116       How the server should receive the metadata required for software configuration.
117     type: string
118     constraints:
119     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
120   CloudDomain:
121     default: ''
122     type: string
123     description: >
124       The DNS domain used for the hosts. This should match the dhcp_domain
125       configured in the Undercloud neutron. Defaults to localdomain.
126   ServerMetadata:
127     default: {}
128     description: >
129       Extra properties or metadata passed to Nova for the created nodes in
130       the overcloud. It's accessible via the Nova metadata API.
131     type: json
132   SchedulerHints:
133     type: json
134     description: Optional scheduler hints to pass to nova
135     default: {}
136
137
138 resources:
139   BlockStorage:
140     type: OS::Nova::Server
141     properties:
142       image:
143         {get_param: Image}
144       flavor: {get_param: Flavor}
145       key_name: {get_param: KeyName}
146       networks:
147         - network: ctlplane
148       user_data_format: SOFTWARE_CONFIG
149       user_data: {get_resource: UserData}
150       name: {get_param: Hostname}
151       software_config_transport: {get_param: SoftwareConfigTransport}
152       metadata: {get_param: ServerMetadata}
153       scheduler_hints: {get_param: SchedulerHints}
154
155   # Combine the NodeAdminUserData and NodeUserData mime archives
156   UserData:
157     type: OS::Heat::MultipartMime
158     properties:
159       parts:
160       - config: {get_resource: NodeAdminUserData}
161         type: multipart
162       - config: {get_resource: NodeUserData}
163         type: multipart
164
165   # Creates the "heat-admin" user if configured via the environment
166   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
167   NodeAdminUserData:
168     type: OS::TripleO::NodeAdminUserData
169
170   # For optional operator additional userdata
171   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
172   NodeUserData:
173     type: OS::TripleO::NodeUserData
174
175   InternalApiPort:
176     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
177     properties:
178       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
179
180   StoragePort:
181     type: OS::TripleO::BlockStorage::Ports::StoragePort
182     properties:
183       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
184
185   StorageMgmtPort:
186     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
187     properties:
188       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
189
190   ManagementPort:
191     type: OS::TripleO::BlockStorage::Ports::ManagementPort
192     properties:
193       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
194
195   NetworkConfig:
196     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
197     properties:
198       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
199       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
200       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
201       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
202       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
203
204   NetIpMap:
205     type: OS::TripleO::Network::Ports::NetIpMap
206     properties:
207       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
208       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
209       StorageIp: {get_attr: [StoragePort, ip_address]}
210       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
211       ManagementIp: {get_attr: [ManagementPort, ip_address]}
212
213   NetworkDeployment:
214     type: OS::TripleO::SoftwareDeployment
215     properties:
216       config: {get_resource: NetworkConfig}
217       server: {get_resource: BlockStorage}
218       actions: {get_param: NetworkDeploymentActions}
219
220   BlockStorageDeployment:
221     type: OS::Heat::StructuredDeployment
222     depends_on: NetworkDeployment
223     properties:
224       server: {get_resource: BlockStorage}
225       config: {get_resource: BlockStorageConfig}
226       input_values:
227         debug: {get_param: Debug}
228         cinder_dsn: {list_join: ['', ['mysql://cinder:', {get_param: CinderPassword}, '@', {get_param: MysqlVirtualIP} , '/cinder']]}
229         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
230         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
231         cinder_lvm_loop_device_size:
232           str_replace:
233             template: sizeM
234             params:
235               size: {get_param: CinderLVMLoopDeviceSize}
236         cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
237         cinder_iscsi_helper: {get_param: CinderISCSIHelper}
238         cinder_iscsi_ip_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
239         glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]}
240         rabbit_username: {get_param: RabbitUserName}
241         rabbit_password: {get_param: RabbitPassword}
242         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
243         rabbit_client_port: {get_param: RabbitClientPort}
244         ntp_servers: {get_param: NtpServer}
245         enable_package_install: {get_param: EnablePackageInstall}
246         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
247
248   # Map heat metadata into hiera datafiles
249   BlockStorageConfig:
250     type: OS::Heat::StructuredConfig
251     properties:
252       group: os-apply-config
253       config:
254         hiera:
255           hierarchy:
256             - '"%{::uuid}"'
257             - heat_config_%{::deploy_config_name}
258             - volume_extraconfig
259             - extraconfig
260             - volume
261             - all_nodes # provided by allNodesConfig
262             - '"%{::osfamily}"'
263             - common
264           datafiles:
265             common:
266               raw_data: {get_file: hieradata/common.yaml}
267             volume_extraconfig:
268               mapped_data: {get_param: BlockStorageExtraConfig}
269             extraconfig:
270               mapped_data: {get_param: ExtraConfig}
271             volume:
272               raw_data: {get_file: hieradata/volume.yaml}
273               mapped_data:
274                 # Cinder
275                 cinder::debug: {get_input: debug}
276                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
277                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
278                 cinder::database_connection: {get_input: cinder_dsn}
279                 cinder::rabbit_userid: {get_input: rabbit_username}
280                 cinder::rabbit_password: {get_input: rabbit_password}
281                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
282                 cinder::rabbit_port: {get_input: rabbit_client_port}
283                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
284                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
285                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
286                 ntp::servers: {get_input: ntp_servers}
287                 tripleo::packages::enable_install: {get_input: enable_package_install}
288                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
289                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
290                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
291
292   # Resource for site-specific injection of root certificate
293   NodeTLSCAData:
294     depends_on: BlockStorageDeployment
295     type: OS::TripleO::NodeTLSCAData
296     properties:
297       server: {get_resource: BlockStorage}
298
299   # Hook for site-specific additional pre-deployment config,
300   # applying to all nodes, e.g node registration/unregistration
301   NodeExtraConfig:
302     depends_on: NodeTLSCAData
303     type: OS::TripleO::NodeExtraConfig
304     properties:
305         server: {get_resource: BlockStorage}
306
307   UpdateConfig:
308     type: OS::TripleO::Tasks::PackageUpdate
309
310   UpdateDeployment:
311     type: OS::Heat::SoftwareDeployment
312     properties:
313       config: {get_resource: UpdateConfig}
314       server: {get_resource: BlockStorage}
315       input_values:
316         update_identifier:
317           get_param: UpdateIdentifier
318
319 outputs:
320   hosts_entry:
321     value:
322       str_replace:
323         template: "IP HOST.DOMAIN HOST"
324         params:
325           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
326           DOMAIN: {get_param: CloudDomain}
327           HOST: {get_attr: [BlockStorage, name]}
328   nova_server_resource:
329     description: Heat resource handle for the block storage server
330     value:
331       {get_resource: BlockStorage}
332   internal_api_ip_address:
333     description: IP address of the server in the internal_api network
334     value: {get_attr: [InternalApiPort, ip_address]}
335   storage_ip_address:
336     description: IP address of the server in the storage network
337     value: {get_attr: [StoragePort, ip_address]}
338   storage_mgmt_ip_address:
339     description: IP address of the server in the storage_mgmt network
340     value: {get_attr: [StorageMgmtPort, ip_address]}
341   management_ip_address:
342     description: IP address of the server in the management network
343     value: {get_attr: [ManagementPort, ip_address]}
344   config_identifier:
345     description: identifier which changes if the node configuration may need re-applying
346     value:
347       list_join:
348         - ''
349         - - {get_attr: [BlockStorageDeployment, deploy_stdout]}
350           - {get_attr: [NodeTLSCAData, deploy_stdout]}
351           - {get_param: UpdateIdentifier}