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