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