Merge "Clarify Kolla build overrides for tripleo"
[apex-tripleo-heat-templates.git] / docker / services / swift-storage.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack containerized Swift Storage services.
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerSwiftProxyImage:
12     description: image
13     default: 'centos-binary-swift-proxy-server:latest'
14     type: string
15   DockerSwiftAccountImage:
16     description: image
17     default: 'centos-binary-swift-account:latest'
18     type: string
19   DockerSwiftContainerImage:
20     description: image
21     default: 'centos-binary-swift-container:latest'
22     type: string
23   DockerSwiftObjectImage:
24     description: image
25     default: 'centos-binary-swift-object:latest'
26     type: string
27   EndpointMap:
28     default: {}
29     description: Mapping of service endpoint -> protocol. Typically set
30                  via parameter_defaults in the resource registry.
31     type: json
32   DefaultPasswords:
33     default: {}
34     type: json
35   ServiceNetMap:
36     default: {}
37     description: Mapping of service_name -> network name. Typically set
38                  via parameter_defaults in the resource registry.  This
39                  mapping overrides those in ServiceNetMapDefaults.
40     type: json
41
42 resources:
43
44   SwiftStorageBase:
45     type: ../../puppet/services/swift-storage.yaml
46     properties:
47       EndpointMap: {get_param: EndpointMap}
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50
51 outputs:
52   role_data:
53     description: Role data for the swift storage services.
54     value:
55       service_name: {get_attr: [SwiftStorageBase, role_data, service_name]}
56       config_settings: {get_attr: [SwiftStorageBase, role_data, config_settings]}
57       step_config: &step_config
58         get_attr: [SwiftStorageBase, role_data, step_config]
59       service_config_settings: {get_attr: [SwiftStorageBase, role_data, service_config_settings]}
60       # BEGIN DOCKER SETTINGS
61       puppet_config:
62         config_volume: swift
63         puppet_tags: swift_config,swift_container_config,swift_container_sync_realms_config,swift_account_config,swift_object_config,swift_object_expirer_config
64         step_config: *step_config
65         config_image: &swift_proxy_image
66           list_join:
67             - '/'
68             - [ {get_param: DockerNamespace}, {get_param: DockerSwiftProxyImage} ]
69       kolla_config:
70         /var/lib/kolla/config_files/swift_account_auditor.json:
71           command: /usr/bin/swift-account-auditor /etc/swift/account-server.conf
72         /var/lib/kolla/config_files/swift_account_reaper.json:
73           command: /usr/bin/swift-account-reaper /etc/swift/account-server.conf
74         /var/lib/kolla/config_files/swift_account_replicator.json:
75           command: /usr/bin/swift-account-replicator /etc/swift/account-server.conf
76         /var/lib/kolla/config_files/swift_account_server.json:
77           command: /usr/bin/swift-account-server /etc/swift/account-server.conf
78         /var/lib/kolla/config_files/swift_container_auditor.json:
79           command: /usr/bin/swift-container-auditor /etc/swift/container-server.conf
80         /var/lib/kolla/config_files/swift_container_replicator.json:
81           command: /usr/bin/swift-container-replicator /etc/swift/container-server.conf
82         /var/lib/kolla/config_files/swift_container_updater.json:
83           command: /usr/bin/swift-container-updater /etc/swift/container-server.conf
84         /var/lib/kolla/config_files/swift_container_server.json:
85           command: /usr/bin/swift-container-server /etc/swift/container-server.conf
86         /var/lib/kolla/config_files/swift_object_auditor.json:
87           command: /usr/bin/swift-object-auditor /etc/swift/object-server.conf
88         /var/lib/kolla/config_files/swift_object_expirer.json:
89           command: /usr/bin/swift-object-expirer /etc/swift/object-expirer.conf
90         /var/lib/kolla/config_files/swift_object_replicator.json:
91           command: /usr/bin/swift-object-replicator /etc/swift/object-server.conf
92         /var/lib/kolla/config_files/swift_object_updater.json:
93           command: /usr/bin/swift-object-updater /etc/swift/object-server.conf
94         /var/lib/kolla/config_files/swift_object_server.json:
95           command: /usr/bin/swift-object-server /etc/swift/object-server.conf
96       docker_config:
97         step_3:
98           # The puppet config sets this up but we don't have a way to mount the named
99           # volume during the configuration stage.  We just need to create this
100           # directory and make sure it's owned by swift.
101           swift_setup_srv:
102             image: &swift_account_image
103               list_join:
104                 - '/'
105                 - [ {get_param: DockerNamespace}, {get_param: DockerSwiftAccountImage} ]
106             user: root
107             command: ['chown', '-R', 'swift:', '/srv/node']
108             volumes:
109               - /srv/node:/srv/node
110         step_4:
111           swift_account_auditor:
112             image: *swift_account_image
113             net: host
114             user: swift
115             restart: always
116             volumes:
117               - /var/lib/kolla/config_files/swift_account_auditor.json:/var/lib/kolla/config_files/config.json:ro
118               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
119               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
120               - /etc/hosts:/etc/hosts:ro
121               - /etc/localtime:/etc/localtime:ro
122               - /run:/run
123               - /srv/node:/srv/node
124               - /dev:/dev
125             environment: &kolla_env
126               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
127           swift_account_reaper:
128             image: *swift_account_image
129             net: host
130             user: swift
131             restart: always
132             volumes:
133               - /var/lib/kolla/config_files/swift_account_reaper.json:/var/lib/kolla/config_files/config.json:ro
134               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
135               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
136               - /etc/hosts:/etc/hosts:ro
137               - /etc/localtime:/etc/localtime:ro
138               - /run:/run
139               - /srv/node:/srv/node
140               - /dev:/dev
141             environment: *kolla_env
142           swift_account_replicator:
143             image: *swift_account_image
144             net: host
145             user: swift
146             restart: always
147             volumes:
148               - /var/lib/kolla/config_files/swift_account_replicator.json:/var/lib/kolla/config_files/config.json:ro
149               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
150               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
151               - /etc/hosts:/etc/hosts:ro
152               - /etc/localtime:/etc/localtime:ro
153               - /run:/run
154               - /srv/node:/srv/node
155               - /dev:/dev
156             environment: *kolla_env
157           swift_account_server:
158             image: *swift_account_image
159             net: host
160             user: swift
161             restart: always
162             volumes:
163               - /var/lib/kolla/config_files/swift_account_server.json:/var/lib/kolla/config_files/config.json:ro
164               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
165               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
166               - /etc/hosts:/etc/hosts:ro
167               - /etc/localtime:/etc/localtime:ro
168               - /run:/run
169               - /srv/node:/srv/node
170               - /dev:/dev
171             environment: *kolla_env
172           swift_container_auditor:
173             image: &swift_container_image
174               list_join:
175                 - '/'
176                 - [ {get_param: DockerNamespace}, {get_param: DockerSwiftContainerImage} ]
177             net: host
178             user: swift
179             restart: always
180             volumes:
181               - /var/lib/kolla/config_files/swift_container_auditor.json:/var/lib/kolla/config_files/config.json:ro
182               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
183               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
184               - /etc/hosts:/etc/hosts:ro
185               - /etc/localtime:/etc/localtime:ro
186               - /run:/run
187               - /srv/node:/srv/node
188               - /dev:/dev
189             environment: *kolla_env
190           swift_container_replicator:
191             image: *swift_container_image
192             net: host
193             user: swift
194             restart: always
195             volumes:
196               - /var/lib/kolla/config_files/swift_container_replicator.json:/var/lib/kolla/config_files/config.json:ro
197               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
198               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
199               - /etc/hosts:/etc/hosts:ro
200               - /etc/localtime:/etc/localtime:ro
201               - /run:/run
202               - /srv/node:/srv/node
203               - /dev:/dev
204             environment: *kolla_env
205           swift_container_updater:
206             image: *swift_container_image
207             net: host
208             user: swift
209             restart: always
210             volumes:
211               - /var/lib/kolla/config_files/swift_container_updater.json:/var/lib/kolla/config_files/config.json:ro
212               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
213               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
214               - /etc/hosts:/etc/hosts:ro
215               - /etc/localtime:/etc/localtime:ro
216               - /run:/run
217               - /srv/node:/srv/node
218               - /dev:/dev
219             environment: *kolla_env
220           swift_container_server:
221             image: *swift_container_image
222             net: host
223             user: swift
224             restart: always
225             volumes:
226               - /var/lib/kolla/config_files/swift_container_server.json:/var/lib/kolla/config_files/config.json:ro
227               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
228               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
229               - /etc/hosts:/etc/hosts:ro
230               - /etc/localtime:/etc/localtime:ro
231               - /run:/run
232               - /srv/node:/srv/node
233               - /dev:/dev
234             environment: *kolla_env
235           swift_object_auditor:
236             image: &swift_object_image
237               list_join:
238                 - '/'
239                 - [ {get_param: DockerNamespace}, {get_param: DockerSwiftObjectImage} ]
240             net: host
241             user: swift
242             restart: always
243             volumes:
244               - /var/lib/kolla/config_files/swift_object_auditor.json:/var/lib/kolla/config_files/config.json:ro
245               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
246               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
247               - /etc/hosts:/etc/hosts:ro
248               - /etc/localtime:/etc/localtime:ro
249               - /run:/run
250               - /srv/node:/srv/node
251               - /dev:/dev
252             environment: *kolla_env
253           swift_object_expirer:
254             image: *swift_proxy_image
255             net: host
256             user: swift
257             restart: always
258             volumes:
259               - /var/lib/kolla/config_files/swift_object_expirer.json:/var/lib/kolla/config_files/config.json:ro
260               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
261               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
262               - /etc/hosts:/etc/hosts:ro
263               - /etc/localtime:/etc/localtime:ro
264               - /run:/run
265               - /srv/node:/srv/node
266               - /dev:/dev
267             environment: *kolla_env
268           swift_object_replicator:
269             image: *swift_object_image
270             net: host
271             user: swift
272             restart: always
273             volumes:
274               - /var/lib/kolla/config_files/swift_object_replicator.json:/var/lib/kolla/config_files/config.json:ro
275               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
276               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
277               - /etc/hosts:/etc/hosts:ro
278               - /etc/localtime:/etc/localtime:ro
279               - /run:/run
280               - /srv/node:/srv/node
281               - /dev:/dev
282             environment: *kolla_env
283           swift_object_updater:
284             image: *swift_object_image
285             net: host
286             user: swift
287             restart: always
288             volumes:
289               - /var/lib/kolla/config_files/swift_object_updater.json:/var/lib/kolla/config_files/config.json:ro
290               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
291               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
292               - /etc/hosts:/etc/hosts:ro
293               - /etc/localtime:/etc/localtime:ro
294               - /run:/run
295               - /srv/node:/srv/node
296               - /dev:/dev
297             environment: *kolla_env
298           swift_object_server:
299             image: *swift_object_image
300             net: host
301             user: swift
302             restart: always
303             volumes:
304               - /var/lib/kolla/config_files/swift_object_server.json:/var/lib/kolla/config_files/config.json:ro
305               - /var/lib/config-data/swift/:/var/lib/kolla/config_files/src:ro
306               - /var/lib/config-data/swift/etc/swift:/etc/swift:rw
307               - /etc/hosts:/etc/hosts:ro
308               - /etc/localtime:/etc/localtime:ro
309               - /run:/run
310               - /srv/node:/srv/node
311               - /dev:/dev
312             environment: *kolla_env
313       host_prep_tasks:
314         - name: create /srv/node
315           file:
316             path: /srv/node
317             state: directory
318       upgrade_tasks:
319         - name: Stop and disable swift storage services
320           tags: step2
321           service: name={{ item }} state=stopped enabled=no
322           with_items:
323             - openstack-swift-account-auditor
324             - openstack-swift-account-reaper
325             - openstack-swift-account-replicator
326             - openstack-swift-account
327             - openstack-swift-container-auditor
328             - openstack-swift-container-replicator
329             - openstack-swift-container-updater
330             - openstack-swift-container
331             - openstack-swift-object-auditor
332             - openstack-swift-object-replicator
333             - openstack-swift-object-updater
334             - openstack-swift-object