Merge "Drive DB initialization via Hiera"
[apex-tripleo-heat-templates.git] / puppet / cinder-storage-puppet.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: NodeUserData}
124       name: {get_param: Hostname}
125
126   NodeUserData:
127     type: OS::TripleO::NodeUserData
128
129   InternalApiPort:
130     type: OS::TripleO::BlockStorage::Ports::InternalApiPort
131     properties:
132       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
133
134   StoragePort:
135     type: OS::TripleO::BlockStorage::Ports::StoragePort
136     properties:
137       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
138
139   StorageMgmtPort:
140     type: OS::TripleO::BlockStorage::Ports::StorageMgmtPort
141     properties:
142       ControlPlaneIP: {get_attr: [BlockStorage, networks, ctlplane, 0]}
143
144   NetworkConfig:
145     type: OS::TripleO::BlockStorage::Net::SoftwareConfig
146     properties:
147       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
148       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
149       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
150
151   NetIpMap:
152     type: OS::TripleO::Network::Ports::NetIpMap
153     properties:
154       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
155       StorageIp: {get_attr: [StoragePort, ip_address]}
156       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
157
158   NetworkDeployment:
159     type: OS::TripleO::SoftwareDeployment
160     properties:
161       config: {get_resource: NetworkConfig}
162       server: {get_resource: BlockStorage}
163
164   BlockStorageDeployment:
165     type: OS::Heat::StructuredDeployment
166     depends_on: NetworkDeployment
167     properties:
168       server: {get_resource: BlockStorage}
169       config: {get_resource: BlockStorageConfig}
170       input_values:
171         debug: {get_param: Debug}
172         cinder_dsn: {list_join: ['', ['mysql://cinder:', {get_param: CinderPassword}, '@', {get_param: MysqlVirtualIP} , '/cinder']]}
173         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
174         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
175         cinder_lvm_loop_device_size:
176           str_replace:
177             template: sizeM
178             params:
179               size: {get_param: CinderLVMLoopDeviceSize}
180         cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
181         cinder_iscsi_helper: {get_param: CinderISCSIHelper}
182         cinder_iscsi_ip_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, CinderIscsiNetwork]}]}
183         glance_api_servers:
184           list_join:
185             - ''
186             - - {get_param: GlanceProtocol}
187               - '://'
188               - {get_param: GlanceApiVirtualIP}
189               - ':'
190               - {get_param: GlancePort}
191         rabbit_username: {get_param: RabbitUserName}
192         rabbit_password: {get_param: RabbitPassword}
193         rabbit_client_use_ssl: {get_param: RabbitClientUseSSL}
194         rabbit_client_port: {get_param: RabbitClientPort}
195         ntp_servers:
196           str_replace:
197             template: '["server"]'
198             params:
199               server: {get_param: NtpServer}
200         enable_package_install: {get_param: EnablePackageInstall}
201
202   # Map heat metadata into hiera datafiles
203   BlockStorageConfig:
204     type: OS::Heat::StructuredConfig
205     properties:
206       group: os-apply-config
207       config:
208         hiera:
209           hierarchy:
210             - heat_config_%{::deploy_config_name}
211             - volume_extraconfig
212             - extraconfig
213             - volume
214             - all_nodes # provided by allNodesConfig
215             - '"%{::osfamily}"'
216             - common
217           datafiles:
218             common:
219               raw_data: {get_file: hieradata/common.yaml}
220             volume_extraconfig:
221               mapped_data: {get_param: BlockStorageExtraConfig}
222             extraconfig:
223               mapped_data: {get_param: ExtraConfig}
224             volume:
225               raw_data: {get_file: hieradata/volume.yaml}
226               mapped_data:
227                 # Cinder
228                 cinder::debug: {get_input: debug}
229                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
230                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
231                 cinder::database_connection: {get_input: cinder_dsn}
232                 cinder::rabbit_userid: {get_input: rabbit_username}
233                 cinder::rabbit_password: {get_input: rabbit_password}
234                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
235                 cinder::rabbit_port: {get_input: rabbit_client_port}
236                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
237                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
238                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
239                 ntp::servers: {get_input: ntp_servers}
240                 tripleo::packages::enable_install: {get_input: enable_package_install}
241                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
242                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
243
244   UpdateConfig:
245     type: OS::TripleO::Tasks::PackageUpdate
246
247   UpdateDeployment:
248     type: OS::Heat::SoftwareDeployment
249     properties:
250       config: {get_resource: UpdateConfig}
251       server: {get_resource: BlockStorage}
252       input_values:
253         update_identifier:
254           get_param: UpdateIdentifier
255
256 outputs:
257   hosts_entry:
258     value:
259       str_replace:
260         template: "IP HOST.localdomain HOST"
261         params:
262           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
263           HOST: {get_attr: [BlockStorage, name]}
264   nova_server_resource:
265     description: Heat resource handle for the block storage server
266     value:
267       {get_resource: BlockStorage}
268   internal_api_ip_address:
269     description: IP address of the server in the internal_api network
270     value: {get_attr: [InternalApiPort, ip_address]}
271   storage_ip_address:
272     description: IP address of the server in the storage network
273     value: {get_attr: [StoragePort, ip_address]}
274   storage_mgmt_ip_address:
275     description: IP address of the server in the storage_mgmt network
276     value: {get_attr: [StorageMgmtPort, ip_address]}
277   config_identifier:
278     description: identifier which changes if the node configuration may need re-applying
279     value: {get_attr: [BlockStorageDeployment, deploy_stdout]}