Merge "Make archive policy configurable" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / barbican-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Barbican API service
5
6 parameters:
7   DockerBarbicanApiImage:
8     description: image
9     type: string
10   DockerBarbicanConfigImage:
11     description: The container image to use for the barbican 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   MySQLClient:
53     type: ../../puppet/services/database/mysql-client.yaml
54
55   BarbicanApiBase:
56     type: ../../puppet/services/barbican-api.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceData: {get_param: ServiceData}
60       ServiceNetMap: {get_param: ServiceNetMap}
61       DefaultPasswords: {get_param: DefaultPasswords}
62       RoleName: {get_param: RoleName}
63       RoleParameters: {get_param: RoleParameters}
64
65 outputs:
66   role_data:
67     description: Role data for the Barbican API role.
68     value:
69       service_name: {get_attr: [BarbicanApiBase, role_data, service_name]}
70       config_settings:
71         map_merge:
72           - get_attr: [BarbicanApiBase, role_data, config_settings]
73           - apache::default_vhost: false
74       step_config: &step_config
75         list_join:
76           - "\n"
77           - - {get_attr: [BarbicanApiBase, role_data, step_config]}
78             - {get_attr: [MySQLClient, role_data, step_config]}
79       service_config_settings: {get_attr: [BarbicanApiBase, role_data, service_config_settings]}
80       # BEGIN DOCKER SETTINGS
81       puppet_config:
82         config_volume: barbican
83         puppet_tags: barbican_api_paste_ini,barbican_config
84         step_config: *step_config
85         config_image: {get_param: DockerBarbicanConfigImage}
86       kolla_config:
87         /var/lib/kolla/config_files/barbican_api.json:
88           command: /usr/sbin/httpd -DFOREGROUND
89           config_files:
90             - source: "/var/lib/kolla/config_files/src/*"
91               dest: "/"
92               merge: true
93               preserve_properties: true
94       docker_config:
95         # db sync runs before permissions set by kolla_config
96         step_2:
97           barbican_init_logs:
98             image: &barbican_api_image {get_param: DockerBarbicanApiImage}
99             privileged: false
100             user: root
101             volumes:
102               - /var/log/containers/barbican:/var/log/barbican
103             command: ['/bin/bash', '-c', 'chown -R barbican:barbican /var/log/barbican']
104         step_3:
105           barbican_api_db_sync:
106             start_order: 0
107             image: *barbican_api_image
108             net: host
109             detach: false
110             user: root
111             volumes: &barbican_api_volumes
112               list_concat:
113                 - {get_attr: [ContainersCommon, volumes]}
114                 -
115                   - /var/lib/config-data/barbican/etc/barbican/:/etc/barbican/:ro
116                   - /var/log/containers/barbican:/var/log/barbican
117             command: "/usr/bin/bootstrap_host_exec barbican_api su barbican -s /bin/bash -c '/usr/bin/barbican-manage db upgrade'"
118         step_4:
119           barbican_api:
120             image: *barbican_api_image
121             net: host
122             privileged: false
123             restart: always
124             user: root
125             volumes:
126               list_concat:
127                 - {get_attr: [ContainersCommon, volumes]}
128                 -
129                   - /var/lib/kolla/config_files/barbican_api.json:/var/lib/kolla/config_files/config.json:ro
130                   - /var/log/containers/barbican:/var/log/barbican
131                   - /var/lib/config-data/puppet-generated/barbican/:/var/lib/kolla/config_files/src:ro
132                   -
133                     if:
134                       - internal_tls_enabled
135                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
136                       - ''
137                   -
138                     if:
139                       - internal_tls_enabled
140                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
141                       - ''
142             environment:
143               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
144       host_prep_tasks:
145         - name: create persistent logs directory
146           file:
147             path: /var/log/containers/barbican
148             state: directory
149       upgrade_tasks:
150         - name: Stop and disable barbican_api service
151           tags: step2
152           service: name=openstack-barbican-api state=stopped enabled=no
153       metadata_settings:
154         get_attr: [BarbicanApiBase, role_data, metadata_settings]