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