b3579429540ff49a73b612532273a6a0bc25c39d
[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: NodeUserData}
93       name: {get_param: Hostname}
94
95   NodeUserData:
96     type: OS::TripleO::NodeUserData
97
98   InternalApiPort:
99     type: OS::TripleO::SwiftStorage::Ports::InternalApiPort
100     properties:
101       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
102
103   StoragePort:
104     type: OS::TripleO::SwiftStorage::Ports::StoragePort
105     properties:
106       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
107
108   StorageMgmtPort:
109     type: OS::TripleO::SwiftStorage::Ports::StorageMgmtPort
110     properties:
111       ControlPlaneIP: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
112
113   NetworkConfig:
114     type: OS::TripleO::ObjectStorage::Net::SoftwareConfig
115     properties:
116       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
117       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
118       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
119
120   NetIpMap:
121     type: OS::TripleO::Network::Ports::NetIpMap
122     properties:
123       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
124       StorageIp: {get_attr: [StoragePort, ip_address]}
125       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
126
127   NetworkDeployment:
128     type: OS::TripleO::SoftwareDeployment
129     properties:
130       config: {get_resource: NetworkConfig}
131       server: {get_resource: SwiftStorage}
132
133   SwiftStorageHieraConfig:
134     type: OS::Heat::StructuredConfig
135     properties:
136       group: os-apply-config
137       config:
138         hiera:
139           hierarchy:
140             - heat_config_%{::deploy_config_name}
141             - object_extraconfig
142             - extraconfig
143             - object
144             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
145             - all_nodes # provided by allNodesConfig
146             - '"%{::osfamily}"'
147             - common
148           datafiles:
149             common:
150               raw_data: {get_file: hieradata/common.yaml}
151             object_extraconfig:
152               mapped_data: {get_param: ObjectStorageExtraConfig}
153             extraconfig:
154               mapped_data: {get_param: ExtraConfig}
155             object:
156               raw_data: {get_file: hieradata/object.yaml}
157               mapped_data: # data supplied directly to this deployment configuration, etc
158                 swift::swift_hash_suffix: { get_input: swift_hash_suffix }
159                 tripleo::ringbuilder::part_power: { get_input: swift_part_power }
160                 tripleo::ringbuilder::replicas: {get_input: swift_replicas }
161                 # Swift
162                 swift::storage::all::storage_local_net_ip: {get_input: swift_management_network}
163                 swift_mount_check: {get_input: swift_mount_check }
164                 tripleo::ringbuilder::min_part_hours: { get_input: swift_min_part_hours }
165                 ntp::servers: {get_input: ntp_servers}
166                 # NOTE(dprince): build_ring support is currently not wired in.
167                 # See: https://review.openstack.org/#/c/109225/
168                 tripleo::ringbuilder::build_ring: True
169                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
170                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
171                 tripleo::packages::enable_install: {get_input: enable_package_install}
172
173
174   SwiftStorageHieraDeploy:
175     type: OS::Heat::StructuredDeployment
176     depends_on: NetworkDeployment
177     properties:
178       server: {get_resource: SwiftStorage}
179       config: {get_resource: SwiftStorageHieraConfig}
180       input_values:
181         local_ip: {get_attr: [SwiftStorage, networks, ctlplane, 0]}
182         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
183         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
184         swift_hash_suffix: {get_param: HashSuffix}
185         swift_mount_check: {get_param: MountCheck}
186         swift_min_part_hours: {get_param: MinPartHours}
187         swift_part_power: {get_param: PartPower}
188         swift_replicas: { get_param: Replicas}
189         ntp_servers:
190           str_replace:
191             template: '["server"]'
192             params:
193               server: {get_param: NtpServer}
194         enable_package_install: {get_param: EnablePackageInstall}
195         swift_management_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
196
197   UpdateConfig:
198     type: OS::TripleO::Tasks::PackageUpdate
199
200   UpdateDeployment:
201     type: OS::Heat::SoftwareDeployment
202     properties:
203       config: {get_resource: UpdateConfig}
204       server: {get_resource: SwiftStorage}
205       input_values:
206         update_identifier:
207           get_param: UpdateIdentifier
208
209 outputs:
210   hosts_entry:
211     value:
212       str_replace:
213         template: "IP HOST.localdomain HOST"
214         params:
215           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ObjectStorageHostnameResolveNetwork]}]}
216           HOST: {get_attr: [SwiftStorage, name]}
217   nova_server_resource:
218     description: Heat resource handle for the swift storage server
219     value:
220       {get_resource: SwiftStorage}
221   swift_device:
222     description: Swift device formatted for swift-ring-builder
223     value:
224       str_replace:
225         template: 'r1z1-IP:%PORT%/d1'
226         params:
227           IP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, SwiftMgmtNetwork]}]}
228   internal_api_ip_address:
229     description: IP address of the server in the internal_api network
230     value: {get_attr: [InternalApiPort, ip_address]}
231   storage_ip_address:
232     description: IP address of the server in the storage network
233     value: {get_attr: [StoragePort, ip_address]}
234   storage_mgmt_ip_address:
235     description: IP address of the server in the storage_mgmt network
236     value: {get_attr: [StorageMgmtPort, ip_address]}
237   config_identifier:
238     description: identifier which changes if the node configuration may need re-applying
239     value: {get_attr: [SwiftStorageHieraDeploy, deploy_stdout]}