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