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