Merge "Replace outdated instruction with link to upstream doc"
[apex-tripleo-heat-templates.git] / docker / services / swift-proxy.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized swift proxy service
5
6 parameters:
7   DockerSwiftProxyImage:
8     description: image
9     type: string
10   DockerSwiftConfigImage:
11     description: The container image to use for the swift config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39   EnableInternalTLS:
40     type: boolean
41     default: false
42
43 conditions:
44
45   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
46
47 resources:
48
49   ContainersCommon:
50     type: ./containers-common.yaml
51
52   SwiftProxyBase:
53     type: ../../puppet/services/swift-proxy.yaml
54     properties:
55       EndpointMap: {get_param: EndpointMap}
56       ServiceData: {get_param: ServiceData}
57       ServiceNetMap: {get_param: ServiceNetMap}
58       DefaultPasswords: {get_param: DefaultPasswords}
59       RoleName: {get_param: RoleName}
60       RoleParameters: {get_param: RoleParameters}
61
62 outputs:
63   role_data:
64     description: Role data for the swift proxy.
65     value:
66       service_name: {get_attr: [SwiftProxyBase, role_data, service_name]}
67       config_settings: {get_attr: [SwiftProxyBase, role_data, config_settings]}
68       step_config: &step_config
69         get_attr: [SwiftProxyBase, role_data, step_config]
70       service_config_settings: {get_attr: [SwiftProxyBase, role_data, service_config_settings]}
71       # BEGIN DOCKER SETTINGS
72       puppet_config:
73         config_volume: swift
74         puppet_tags: swift_proxy_config
75         step_config: *step_config
76         config_image: {get_param: DockerSwiftConfigImage}
77       kolla_config:
78         /var/lib/kolla/config_files/swift_proxy.json:
79           command: /usr/bin/swift-proxy-server /etc/swift/proxy-server.conf
80           config_files:
81             - source: "/var/lib/kolla/config_files/src/*"
82               dest: "/"
83               merge: true
84               preserve_properties: true
85           permissions:
86             - path: /var/log/swift
87               owner: swift:swift
88               recurse: true
89         /var/lib/kolla/config_files/swift_proxy_tls_proxy.json:
90           command: /usr/sbin/httpd -DFOREGROUND
91           config_files:
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96       docker_config:
97         step_4:
98           map_merge:
99             - swift_proxy:
100                 image: &swift_proxy_image {get_param: DockerSwiftProxyImage}
101                 net: host
102                 user: swift
103                 restart: always
104                 volumes:
105                   list_concat:
106                     - {get_attr: [ContainersCommon, volumes]}
107                     -
108                       - /var/lib/kolla/config_files/swift_proxy.json:/var/lib/kolla/config_files/config.json:ro
109                       - /var/lib/config-data/puppet-generated/swift/:/var/lib/kolla/config_files/src:ro
110                       - /run:/run
111                       - /srv/node:/srv/node
112                       - /dev:/dev
113                       - /var/log/containers/swift:/var/log/swift
114                 environment:
115                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
116             - if:
117                 - internal_tls_enabled
118                 - swift_proxy_tls_proxy:
119                     image: *swift_proxy_image
120                     net: host
121                     user: root
122                     restart: always
123                     volumes:
124                       list_concat:
125                         - {get_attr: [ContainersCommon, volumes]}
126                         -
127                           - /var/lib/kolla/config_files/swift_proxy_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
128                           - /var/lib/config-data/puppet-generated/swift/:/var/lib/kolla/config_files/src:ro
129                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
130                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
131                     environment:
132                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
133                 - {}
134       host_prep_tasks:
135         - name: create persistent directories
136           file:
137             path: "{{ item }}"
138             state: directory
139           with_items:
140             - /var/log/containers/swift
141             - /srv/node
142       upgrade_tasks:
143         - name: Stop and disable swift_proxy service
144           tags: step2
145           service: name=openstack-swift-proxy state=stopped enabled=no
146       metadata_settings:
147         get_attr: [SwiftProxyBase, role_data, metadata_settings]