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