Allow enabling debug mode for config management (Puppet)
[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
221   # Map heat metadata into hiera datafiles
222   BlockStorageConfig:
223     type: OS::Heat::StructuredConfig
224     properties:
225       group: os-apply-config
226       config:
227         hiera:
228           hierarchy:
229             - '"%{::uuid}"'
230             - heat_config_%{::deploy_config_name}
231             - volume_extraconfig
232             - extraconfig
233             - volume
234             - all_nodes # provided by allNodesConfig
235             - '"%{::osfamily}"'
236             - common
237           datafiles:
238             common:
239               raw_data: {get_file: hieradata/common.yaml}
240             volume_extraconfig:
241               mapped_data: {get_param: BlockStorageExtraConfig}
242             extraconfig:
243               mapped_data: {get_param: ExtraConfig}
244             volume:
245               raw_data: {get_file: hieradata/volume.yaml}
246               mapped_data:
247                 # Cinder
248                 cinder::debug: {get_input: debug}
249                 cinder::setup_test_volume::size: {get_input: cinder_lvm_loop_device_size}
250                 cinder_iscsi_helper: {get_input: cinder_iscsi_helper}
251                 cinder::database_connection: {get_input: cinder_dsn}
252                 cinder::rabbit_userid: {get_input: rabbit_username}
253                 cinder::rabbit_password: {get_input: rabbit_password}
254                 cinder::rabbit_use_ssl: {get_input: rabbit_client_use_ssl}
255                 cinder::rabbit_port: {get_input: rabbit_client_port}
256                 cinder_enable_iscsi_backend: {get_input: cinder_enable_iscsi_backend}
257                 cinder_iscsi_ip_address: {get_input: cinder_iscsi_ip_address}
258                 cinder::glance::glance_api_servers: {get_input: glance_api_servers}
259                 ntp::servers: {get_input: ntp_servers}
260                 tripleo::packages::enable_install: {get_input: enable_package_install}
261                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
262                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
263
264   UpdateConfig:
265     type: OS::TripleO::Tasks::PackageUpdate
266
267   UpdateDeployment:
268     type: OS::Heat::SoftwareDeployment
269     properties:
270       config: {get_resource: UpdateConfig}
271       server: {get_resource: BlockStorage}
272       input_values:
273         update_identifier:
274           get_param: UpdateIdentifier
275
276 outputs:
277   hosts_entry:
278     value:
279       str_replace:
280         template: "IP HOST.localdomain HOST"
281         params:
282           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, BlockStorageHostnameResolveNetwork]}]}
283           HOST: {get_attr: [BlockStorage, name]}
284   nova_server_resource:
285     description: Heat resource handle for the block storage server
286     value:
287       {get_resource: BlockStorage}
288   internal_api_ip_address:
289     description: IP address of the server in the internal_api network
290     value: {get_attr: [InternalApiPort, ip_address]}
291   storage_ip_address:
292     description: IP address of the server in the storage network
293     value: {get_attr: [StoragePort, ip_address]}
294   storage_mgmt_ip_address:
295     description: IP address of the server in the storage_mgmt network
296     value: {get_attr: [StorageMgmtPort, ip_address]}
297   config_identifier:
298     description: identifier which changes if the node configuration may need re-applying
299     value: {get_attr: [BlockStorageDeployment, deploy_stdout]}