5c4ff5a1c3c3858db3fea2a834ab8c89f0dbf997
[apex-tripleo-heat-templates.git] / puppet / swift-storage-puppet.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     type: string
49     default: ''
50   EnablePackageInstall:
51     default: 'false'
52     description: Set to true to enable package installation via Puppet
53     type: boolean
54   UpdateIdentifier:
55     default: ''
56     type: string
57     description: >
58       Setting to a previously unused value during stack-update will trigger
59       package update on all nodes
60   ServiceNetMap:
61     default: {}
62     description: Mapping of service_name -> network name. Typically set
63                  via parameter_defaults in the resource registry.
64     type: json
65   Hostname:
66     type: string
67     default: '' # Defaults to Heat created hostname
68   ExtraConfig:
69     default: {}
70     description: |
71       Additional hiera configuration to inject into the cluster. Note
72       that ObjectStorageExtraConfig takes precedence over ExtraConfig.
73     type: json
74   ObjectStorageExtraConfig:
75     default: {}
76     description: |
77       Role specific additional hiera configuration to inject into the cluster.
78     type: json
79
80
81 resources:
82
83   SwiftStorage:
84     type: OS::Nova::Server
85     properties:
86       image: {get_param: Image}
87       flavor: {get_param: Flavor}
88       key_name: {get_param: KeyName}
89       networks:
90         - network: ctlplane
91       user_data_format: SOFTWARE_CONFIG
92       user_data: {get_resource: UserData}
93       name: {get_param: Hostname}
94
95   # Combine the NodeAdminUserData and NodeUserData mime archives
96   UserData:
97     type: OS::Heat::MultipartMime
98     properties:
99       parts:
100       - config: {get_resource: NodeAdminUserData}
101         type: multipart
102       - config: {get_resource: NodeUserData}
103         type: multipart
104
105   # Creates the "heat-admin" user if configured via the environment
106   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
107   NodeAdminUserData:
108     type: OS::TripleO::NodeAdminUserData
109
110   # For optional operator additional userdata
111   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
112   NodeUserData:
113     type: OS::TripleO::NodeUserData
114
115   InternalApiPort:
116     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
117     properties:
118       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
119
120   StoragePort:
121     type: OS::TripleO::SwiftStorage::Ports::StoragePort
122     properties:
123       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
124
125   StorageMgmtPort:
126     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
127     properties:
128       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
129
130   NetworkConfig:
131     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
132     properties:
133       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
134       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
135       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
136
137   NetIpMap:
138     type: OS::TripleO::Network::Ports::NetIpMap
139     properties:
140       ControlPlaneIp: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
141       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
142       StorageIp: {get_attr: [StoragePort, ip_address]}
143       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
144
145   NetworkDeployment:
146     type: OS::TripleO::SoftwareDeployment
147     properties:
148       config: {get_resource: NetworkConfig}
149       server: {get_resource: SwiftStorage}
150
151   SwiftStorageHieraConfig:
152     type: OS::Heat::StructuredConfig
153     properties:
154       group: os-apply-config
155       config:
156         hiera:
157           hierarchy:
158             - heat_config_%{::deploy_config_name}
159             - object_extraconfig
160             - extraconfig
161             - object
162             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
163             - all_nodes # provided by allNodesConfig
164             - '"%{::osfamily}"'
165             - common
166           datafiles:
167             common:
168               raw_data: {get_file: hieradata/common.yaml}
169             object_extraconfig:
170               mapped_data: {get_param: ObjectStorageExtraConfig}
171             extraconfig:
172               mapped_data: {get_param: ExtraConfig}
173             object:
174               raw_data: {get_file: hieradata/object.yaml}
175               mapped_data: # data supplied directly to this deployment configuration, etc
176                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
177                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
178                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
179                 # Swift
180                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
181                 swift_mount_check: {get_input: swift_mount_check }
182                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
183                 ntp::servers: {get_input: ntp_servers}
184                 # NOTE(dprince): build_ring support is currently not wired in.
185                 # See: https://review.openstack.org/#/c/109225/
186                 tripleo::ringbuilder::build_ring: True
187                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
188                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
189                 tripleo::packages::enable_install: {get_input: enable_package_install}
190
191
192   SwiftStorageHieraDeploy:
193     type: OS::Heat::StructuredDeployment
194     depends_on: NetworkDeployment
195     properties:
196       server: {get_resource: SwiftStorage}
197       config: {get_resource: SwiftStorageHieraConfig}
198       input_values:
199         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
200         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
201         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
202         swift_hash_suffix: {get_param: HashSuffix}
203         swift_mount_check: {get_param: MountCheck}
204         swift_min_part_hours: {get_param: MinPartHours}
205         swift_part_power: {get_param: PartPower}
206         swift_replicas: { get_param: Replicas}
207         ntp_servers:
208           str_replace:
209             template: '["server"]'
210             params:
211               server: {get_param: NtpServer}
212         enable_package_install: {get_param: EnablePackageInstall}
213         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
214
215   UpdateConfig:
216     type: OS::TripleO::Tasks::PackageUpdate
217
218   UpdateDeployment:
219     type: OS::Heat::SoftwareDeployment
220     properties:
221       config: {get_resource: UpdateConfig}
222       server: {get_resource: SwiftStorage}
223       input_values:
224         update_identifier:
225           get_param: UpdateIdentifier
226
227 outputs:
228   hosts_entry:
229     value:
230       str_replace:
231         template: "IP HOST.localdomain HOST"
232         params:
233           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
234           HOST: {get_attr: [SwiftStorage, name]}
235   nova_server_resource:
236     description: Heat resource handle for the swift storage server
237     value:
238       {get_resource: SwiftStorage}
239   swift_device:
240     description: Swift device formatted for swift-ring-builder
241     value:
242       str_replace:
243         template: 'r1z1-IP:%PORT%/d1'
244         params:
245           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
246   internal_api_ip_address:
247     description: IP address of the server in the internal_api network
248     value: {get_attr: [InternalApiPort, ip_address]}
249   storage_ip_address:
250     description: IP address of the server in the storage network
251     value: {get_attr: [StoragePort, ip_address]}
252   storage_mgmt_ip_address:
253     description: IP address of the server in the storage_mgmt network
254     value: {get_attr: [StorageMgmtPort, ip_address]}
255   config_identifier:
256     description: identifier which changes if the node configuration may need re-applying
257     value: {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}