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