Refacter Endpoints into EndpointMap
[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 EC2 KeyPair 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     type: string
79     default: ''
80   EnablePackageInstall:
81     default: 'false'
82     description: Set to true to enable package installation via Puppet
83     type: boolean
84   UpdateIdentifier:
85     default: ''
86     type: string
87     description: >
88       Setting to a previously unused value during stack-update will trigger
89       package update on all nodes
90   Hostname:
91     type: string
92     default: '' # Defaults to Heat created hostname
93   ServiceNetMap:
94     default: {}
95     description: Mapping of service_name -> network name. Typically set
96                  via parameter_defaults in the resource registry.
97     type: json
98   EndpointMap:
99     default: {}
100     description: Mapping of service endpoint -> protocol. Typically set
101                  via parameter_defaults in the resource registry.
102     type: json
103   GlanceApiVirtualIP:
104     type: string
105     default: ''
106   MysqlVirtualIP:
107     type: string
108     default: ''
109
110 resources:
111   BlockStorage:
112     type: OS::Nova::Server
113     properties:
114       image:
115         {get_param: Image}
116       flavor: {get_param: Flavor}
117       key_name: {get_param: KeyName}
118       networks:
119         - network: ctlplane
120       user_data_format: SOFTWARE_CONFIG
121       user_data: {get_resource: UserData}
122       name: {get_param: Hostname}
123
124   # Combine the NodeAdminUserData and NodeUserData mime archives
125   UserData:
126     type: OS::Heat::MultipartMime
127     properties:
128       parts:
129       - config: {get_resource: NodeAdminUserData}
130         type: multipart
131       - config: {get_resource: NodeUserData}
132         type: multipart
133
134   # Creates the "heat-admin" user if configured via the environment
135   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
136   NodeAdminUserData:
137     type: OS::TripleO::NodeAdminUserData
138
139   # For optional operator additional userdata
140   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
141   NodeUserData:
142     type: OS::TripleO::NodeUserData
143
144   InternalApiPort:
145     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
146     properties:
147       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
148
149   StoragePort:
150     type: OS::TripleO::BlockStorage::Ports::StoragePort
151     properties:
152       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
153
154   StorageMgmtPort:
155     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
156     properties:
157       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
158
159   NetworkConfig:
160     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
161     properties:
162       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
163       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
164       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
165       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
166
167   NetIpMap:
168     type: OS::TripleO::Network::Ports::NetIpMap
169     properties:
170       ControlPlaneIp: {get_attr: [BlockStorage, networks, ctlplane, 0]}
171       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
172       StorageIp: {get_attr: [StoragePort, ip_address]}
173       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
174
175   NetworkDeployment:
176     type: OS::TripleO::SoftwareDeployment
177     properties:
178       config: {get_resource: NetworkConfig}
179       server: {get_resource: BlockStorage}
180
181   BlockStorageDeployment:
182     type: OS::Heat::StructuredDeployment
183     depends_on: NetworkDeployment
184     properties:
185       server: {get_resource: BlockStorage}
186       config: {get_resource: BlockStorageConfig}
187       input_values:
188         debug: {get_param: Debug}
189         cinder_dsn: {list_join: ['', ['mysql://cinder:', {get_param: CinderPassword}, '@', {get_param: MysqlVirtualIP} , '/cinder']]}
190         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
191         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
192         cinder_lvm_loop_device_size:
193           str_replace:
194             template: sizeM
195             params:
196               size: {get_param: CinderLVMLoopDeviceSize}
197         cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
198         cinder_iscsi_helper: {get_param: CinderISCSIHelper}
199         cinder_iscsi_ip_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
200         glance_api_servers: {get_param: [EndpointMap, GlanceInternal, uri]}
201         rabbit_username: {get_param: RabbitUserName}
202         rabbit_password: {get_param: RabbitPassword}
203         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
204         rabbit_client_port: {get_param: RabbitClientPort}
205         ntp_servers:
206           str_replace:
207             template: '["server"]'
208             params:
209               server: {get_param: NtpServer}
210         enable_package_install: {get_param: EnablePackageInstall}
211         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
212
213   # Map heat metadata into hiera datafiles
214   BlockStorageConfig:
215     type: OS::Heat::StructuredConfig
216     properties:
217       group: os-apply-config
218       config:
219         hiera:
220           hierarchy:
221             - '"%{::uuid}"'
222             - heat_config_%{::deploy_config_name}
223             - volume_extraconfig
224             - extraconfig
225             - volume
226             - all_nodes # provided by allNodesConfig
227             - '"%{::osfamily}"'
228             - common
229           datafiles:
230             common:
231               raw_data: {get_file: hieradata/common.yaml}
232             volume_extraconfig:
233               mapped_data: {get_param: BlockStorageExtraConfig}
234             extraconfig:
235               mapped_data: {get_param: ExtraConfig}
236             volume:
237               raw_data: {get_file: hieradata/volume.yaml}
238               mapped_data:
239                 # Cinder
240                 cinder::debug: {get_input: debug}
241                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
242                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
243                 cinder::database_connection: {get_input: cinder_dsn}
244                 cinder::rabbit_userid: {get_input: rabbit_username}
245                 cinder::rabbit_password: {get_input: rabbit_password}
246                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
247                 cinder::rabbit_port: {get_input: rabbit_client_port}
248                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
249                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
250                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
251                 ntp::servers: {get_input: ntp_servers}
252                 tripleo::packages::enable_install: {get_input: enable_package_install}
253                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
254                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
255                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
256
257   # Hook for site-specific additional pre-deployment config,
258   # applying to all nodes, e.g node registration/unregistration
259   NodeExtraConfig:
260     depends_on: BlockStorageDeployment
261     type: OS::TripleO::NodeExtraConfig
262     properties:
263         server: {get_resource: BlockStorage}
264
265   UpdateConfig:
266     type: OS::TripleO::Tasks::PackageUpdate
267
268   UpdateDeployment:
269     type: OS::Heat::SoftwareDeployment
270     properties:
271       config: {get_resource: UpdateConfig}
272       server: {get_resource: BlockStorage}
273       input_values:
274         update_identifier:
275           get_param: UpdateIdentifier
276
277 outputs:
278   hosts_entry:
279     value:
280       str_replace:
281         template: "IP HOST.localdomain HOST"
282         params:
283           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
284           HOST: {get_attr: [BlockStorage, name]}
285   nova_server_resource:
286     description: Heat resource handle for the block storage server
287     value:
288       {get_resource: BlockStorage}
289   internal_api_ip_address:
290     description: IP address of the server in the internal_api network
291     value: {get_attr: [InternalApiPort, ip_address]}
292   storage_ip_address:
293     description: IP address of the server in the storage network
294     value: {get_attr: [StoragePort, ip_address]}
295   storage_mgmt_ip_address:
296     description: IP address of the server in the storage_mgmt network
297     value: {get_attr: [StorageMgmtPort, ip_address]}
298   config_identifier:
299     description: identifier which changes if the node configuration may need re-applying
300     value:
301       list_join:
302         - ''
303         - - {get_attr: [BlockStorageDeployment, deploy_stdout]}
304           - {get_param: UpdateIdentifier}