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