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