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