Add Management Network For System Administration.
[apex-tripleo-heat-templates.git] / puppet / swift-storage.yaml
1 heat_template_version: 2015-04-30
2 description: 'OpenStack swift storage node configured by Puppet'
3 parameters:
4   Flavor:
5     description: Flavor for Swift storage nodes to request when deploying.
6     type: string
7     constraints:
8       - custom_constraint: nova.flavor
9   HashSuffix:
10     default: unset
11     description: A random string to be used as a salt when hashing to determine mappings
12       in the ring.
13     hidden: true
14     type: string
15   Image:
16     default: overcloud-swift-storage
17     type: string
18   KeyName:
19     default: default
20     description: Name of an existing Nova key pair to enable SSH access to the instances
21     type: string
22   MountCheck:
23     default: 'false'
24     description: Value of mount_check in Swift account/container/object -server.conf
25     type: boolean
26   MinPartHours:
27     type: number
28     default: 1
29     description: The minimum time (in hours) before a partition in a ring can be moved following a rebalance.
30   PartPower:
31     default: 10
32     description: Partition Power to use when building Swift rings
33     type: number
34   Replicas:
35     type: number
36     default: 3
37     description: How many replicas to use in the swift rings.
38   SnmpdReadonlyUserName:
39     default: ro_snmp_user
40     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
41     type: string
42   SnmpdReadonlyUserPassword:
43     default: unset
44     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
45     type: string
46     hidden: true
47   NtpServer:
48     default: ''
49     description: Comma-separated list of ntp servers
50     type: comma_delimited_list
51   EnablePackageInstall:
52     default: 'false'
53     description: Set to true to enable package installation via Puppet
54     type: boolean
55   UpdateIdentifier:
56     default: ''
57     type: string
58     description: >
59       Setting to a previously unused value during stack-update will trigger
60       package update on all nodes
61   ServiceNetMap:
62     default: {}
63     description: Mapping of service_name -> network name. Typically set
64                  via parameter_defaults in the resource registry.
65     type: json
66   Hostname:
67     type: string
68     default: '' # Defaults to Heat created hostname
69   ExtraConfig:
70     default: {}
71     description: |
72       Additional hiera configuration to inject into the cluster. Note
73       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
74     type: json
75   ObjectStorageExtraConfig:
76     default: {}
77     description: |
78       Role specific additional hiera configuration to inject into the cluster.
79     type: json
80   NetworkDeploymentActions:
81     type: comma_delimited_list
82     description: >
83       Heat action when to apply network configuration changes
84     default: ['CREATE']
85   CloudDomain:
86     default: ''
87     type: string
88     description: >
89       The DNS domain used for the hosts. This should match the dhcp_domain
90       configured in the Undercloud neutron. Defaults to localdomain.
91   ServerMetadata:
92     default: {}
93     description: >
94       Extra properties or metadata passed to Nova for the created nodes in
95       the overcloud. It's accessible via the Nova metadata API.
96     type: json
97   SchedulerHints:
98     type: json
99     description: Optional scheduler hints to pass to nova
100     default: {}
101
102 resources:
103
104   SwiftStorage:
105     type: OS::Nova::Server
106     properties:
107       image: {get_param: Image}
108       flavor: {get_param: Flavor}
109       key_name: {get_param: KeyName}
110       networks:
111         - network: ctlplane
112       user_data_format: SOFTWARE_CONFIG
113       user_data: {get_resource: UserData}
114       name: {get_param: Hostname}
115       metadata: {get_param: ServerMetadata}
116       scheduler_hints: {get_param: SchedulerHints}
117
118   # Combine the NodeAdminUserData and NodeUserData mime archives
119   UserData:
120     type: OS::Heat::MultipartMime
121     properties:
122       parts:
123       - config: {get_resource: NodeAdminUserData}
124         type: multipart
125       - config: {get_resource: NodeUserData}
126         type: multipart
127
128   # Creates the "heat-admin" user if configured via the environment
129   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
130   NodeAdminUserData:
131     type: OS::TripleO::NodeAdminUserData
132
133   # For optional operator additional userdata
134   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
135   NodeUserData:
136     type: OS::TripleO::NodeUserData
137
138   InternalApiPort:
139     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
140     properties:
141       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
142
143   StoragePort:
144     type: OS::TripleO::SwiftStorage::Ports::StoragePort
145     properties:
146       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
147
148   StorageMgmtPort:
149     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
150     properties:
151       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
152
153   ManagementPort:
154     type: OS::TripleO::SwiftStorage::Ports::ManagementPort
155     properties:
156       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
157
158   NetworkConfig:
159     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
160     properties:
161       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
162       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
163       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
164       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
165       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
166
167   NetIpMap:
168     type: OS::TripleO::Network::Ports::NetIpMap
169     properties:
170       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
171       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
172       StorageIp: {get_attr: [StoragePort, ip_address]}
173       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
174       ManagementIp: {get_attr: [ManagementPort, ip_address]}
175
176   NetworkDeployment:
177     type: OS::TripleO::SoftwareDeployment
178     properties:
179       config: {get_resource: NetworkConfig}
180       server: {get_resource: SwiftStorage}
181       actions: {get_param: NetworkDeploymentActions}
182
183   SwiftStorageHieraConfig:
184     type: OS::Heat::StructuredConfig
185     properties:
186       group: os-apply-config
187       config:
188         hiera:
189           hierarchy:
190             - '"%{::uuid}"'
191             - heat_config_%{::deploy_config_name}
192             - object_extraconfig
193             - extraconfig
194             - object
195             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
196             - all_nodes # provided by allNodesConfig
197             - '"%{::osfamily}"'
198             - common
199           datafiles:
200             common:
201               raw_data: {get_file: hieradata/common.yaml}
202             object_extraconfig:
203               mapped_data: {get_param: ObjectStorageExtraConfig}
204             extraconfig:
205               mapped_data: {get_param: ExtraConfig}
206             object:
207               raw_data: {get_file: hieradata/object.yaml}
208               mapped_data: # data supplied directly to this deployment configuration, etc
209                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
210                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
211                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
212                 # Swift
213                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
214                 swift_mount_check: {get_input: swift_mount_check }
215                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
216                 ntp::servers: {get_input: ntp_servers}
217                 # NOTE(dprince): build_ring support is currently not wired in.
218                 # See: https://review.openstack.org/#/c/109225/
219                 tripleo::ringbuilder::build_ring: True
220                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
221                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
222                 tripleo::packages::enable_install: {get_input: enable_package_install}
223                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
224
225
226   SwiftStorageHieraDeploy:
227     type: OS::Heat::StructuredDeployment
228     depends_on: NetworkDeployment
229     properties:
230       server: {get_resource: SwiftStorage}
231       config: {get_resource: SwiftStorageHieraConfig}
232       input_values:
233         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
234         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
235         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
236         swift_hash_suffix: {get_param: HashSuffix}
237         swift_mount_check: {get_param: MountCheck}
238         swift_min_part_hours: {get_param: MinPartHours}
239         swift_part_power: {get_param: PartPower}
240         swift_replicas: { get_param: Replicas}
241         ntp_servers: {get_param: NtpServer}
242         enable_package_install: {get_param: EnablePackageInstall}
243         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
244         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
245
246   # Resource for site-specific injection of root certificate
247   NodeTLSCAData:
248     depends_on: SwiftStorageHieraDeploy
249     type: OS::TripleO::NodeTLSCAData
250     properties:
251       server: {get_resource: SwiftStorage}
252
253   # Hook for site-specific additional pre-deployment config,
254   # applying to all nodes, e.g node registration/unregistration
255   NodeExtraConfig:
256     depends_on: NodeTLSCAData
257     type: OS::TripleO::NodeExtraConfig
258     properties:
259         server: {get_resource: SwiftStorage}
260
261   UpdateConfig:
262     type: OS::TripleO::Tasks::PackageUpdate
263
264   UpdateDeployment:
265     type: OS::Heat::SoftwareDeployment
266     properties:
267       config: {get_resource: UpdateConfig}
268       server: {get_resource: SwiftStorage}
269       input_values:
270         update_identifier:
271           get_param: UpdateIdentifier
272
273 outputs:
274   hosts_entry:
275     value:
276       str_replace:
277         template: "IP HOST.DOMAIN HOST"
278         params:
279           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
280           DOMAIN: {get_param: CloudDomain}
281           HOST: {get_attr: [SwiftStorage, name]}
282   nova_server_resource:
283     description: Heat resource handle for the swift storage server
284     value:
285       {get_resource: SwiftStorage}
286   swift_device:
287     description: Swift device formatted for swift-ring-builder
288     value:
289       str_replace:
290         template: 'r1z1-IP:%PORT%/d1'
291         params:
292           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
293   internal_api_ip_address:
294     description: IP address of the server in the internal_api network
295     value: {get_attr: [InternalApiPort, ip_address]}
296   storage_ip_address:
297     description: IP address of the server in the storage network
298     value: {get_attr: [StoragePort, ip_address]}
299   storage_mgmt_ip_address:
300     description: IP address of the server in the storage_mgmt network
301     value: {get_attr: [StorageMgmtPort, ip_address]}
302   management_ip_address:
303     description: IP address of the server in the management network
304     value: {get_attr: [ManagementPort, 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: [SwiftStorageHieraDeploy, deploy_stdout]}
311           - {get_attr: [NodeTLSCAData, deploy_stdout]}
312           - {get_param: UpdateIdentifier}