Making nova parameters configurable for nuage-metadata-agent
[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 EC2 KeyPair 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
92
93 resources:
94
95   SwiftStorage:
96     type: OS::Nova::Server
97     properties:
98       image: {get_param: Image}
99       flavor: {get_param: Flavor}
100       key_name: {get_param: KeyName}
101       networks:
102         - network: ctlplane
103       user_data_format: SOFTWARE_CONFIG
104       user_data: {get_resource: UserData}
105       name: {get_param: Hostname}
106
107   # Combine the NodeAdminUserData and NodeUserData mime archives
108   UserData:
109     type: OS::Heat::MultipartMime
110     properties:
111       parts:
112       - config: {get_resource: NodeAdminUserData}
113         type: multipart
114       - config: {get_resource: NodeUserData}
115         type: multipart
116
117   # Creates the "heat-admin" user if configured via the environment
118   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
119   NodeAdminUserData:
120     type: OS::TripleO::NodeAdminUserData
121
122   # For optional operator additional userdata
123   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
124   NodeUserData:
125     type: OS::TripleO::NodeUserData
126
127   InternalApiPort:
128     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
129     properties:
130       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
131
132   StoragePort:
133     type: OS::TripleO::SwiftStorage::Ports::StoragePort
134     properties:
135       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
136
137   StorageMgmtPort:
138     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
139     properties:
140       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
141
142   NetworkConfig:
143     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
144     properties:
145       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
146       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
147       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
148       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
149
150   NetIpMap:
151     type: OS::TripleO::Network::Ports::NetIpMap
152     properties:
153       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
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: SwiftStorage}
163       actions: {get_param: NetworkDeploymentActions}
164
165   SwiftStorageHieraConfig:
166     type: OS::Heat::StructuredConfig
167     properties:
168       group: os-apply-config
169       config:
170         hiera:
171           hierarchy:
172             - '"%{::uuid}"'
173             - heat_config_%{::deploy_config_name}
174             - object_extraconfig
175             - extraconfig
176             - object
177             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
178             - all_nodes # provided by allNodesConfig
179             - '"%{::osfamily}"'
180             - common
181           datafiles:
182             common:
183               raw_data: {get_file: hieradata/common.yaml}
184             object_extraconfig:
185               mapped_data: {get_param: ObjectStorageExtraConfig}
186             extraconfig:
187               mapped_data: {get_param: ExtraConfig}
188             object:
189               raw_data: {get_file: hieradata/object.yaml}
190               mapped_data: # data supplied directly to this deployment configuration, etc
191                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
192                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
193                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
194                 # Swift
195                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
196                 swift_mount_check: {get_input: swift_mount_check }
197                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
198                 ntp::servers: {get_input: ntp_servers}
199                 # NOTE(dprince): build_ring support is currently not wired in.
200                 # See: https://review.openstack.org/#/c/109225/
201                 tripleo::ringbuilder::build_ring: True
202                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
203                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
204                 tripleo::packages::enable_install: {get_input: enable_package_install}
205                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
206
207
208   SwiftStorageHieraDeploy:
209     type: OS::Heat::StructuredDeployment
210     depends_on: NetworkDeployment
211     properties:
212       server: {get_resource: SwiftStorage}
213       config: {get_resource: SwiftStorageHieraConfig}
214       input_values:
215         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
216         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
217         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
218         swift_hash_suffix: {get_param: HashSuffix}
219         swift_mount_check: {get_param: MountCheck}
220         swift_min_part_hours: {get_param: MinPartHours}
221         swift_part_power: {get_param: PartPower}
222         swift_replicas: { get_param: Replicas}
223         ntp_servers: {get_param: NtpServer}
224         enable_package_install: {get_param: EnablePackageInstall}
225         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
226         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
227
228   # Resource for site-specific injection of root certificate
229   NodeTLSCAData:
230     depends_on: SwiftStorageHieraDeploy
231     type: OS::TripleO::NodeTLSCAData
232     properties:
233       server: {get_resource: SwiftStorage}
234
235   # Hook for site-specific additional pre-deployment config,
236   # applying to all nodes, e.g node registration/unregistration
237   NodeExtraConfig:
238     depends_on: NodeTLSCAData
239     type: OS::TripleO::NodeExtraConfig
240     properties:
241         server: {get_resource: SwiftStorage}
242
243   UpdateConfig:
244     type: OS::TripleO::Tasks::PackageUpdate
245
246   UpdateDeployment:
247     type: OS::Heat::SoftwareDeployment
248     properties:
249       config: {get_resource: UpdateConfig}
250       server: {get_resource: SwiftStorage}
251       input_values:
252         update_identifier:
253           get_param: UpdateIdentifier
254
255 outputs:
256   hosts_entry:
257     value:
258       str_replace:
259         template: "IP HOST.DOMAIN HOST"
260         params:
261           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
262           DOMAIN: {get_param: CloudDomain}
263           HOST: {get_attr: [SwiftStorage, name]}
264   nova_server_resource:
265     description: Heat resource handle for the swift storage server
266     value:
267       {get_resource: SwiftStorage}
268   swift_device:
269     description: Swift device formatted for swift-ring-builder
270     value:
271       str_replace:
272         template: 'r1z1-IP:%PORT%/d1'
273         params:
274           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
275   internal_api_ip_address:
276     description: IP address of the server in the internal_api network
277     value: {get_attr: [InternalApiPort, ip_address]}
278   storage_ip_address:
279     description: IP address of the server in the storage network
280     value: {get_attr: [StoragePort, ip_address]}
281   storage_mgmt_ip_address:
282     description: IP address of the server in the storage_mgmt network
283     value: {get_attr: [StorageMgmtPort, ip_address]}
284   config_identifier:
285     description: identifier which changes if the node configuration may need re-applying
286     value:
287       list_join:
288         - ','
289         - - {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}
290           - {get_attr: [NodeTLSCAData, deploy_stdout]}
291           - {get_param: UpdateIdentifier}