Merge "Add IronicPxe to the default controller" 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   UpgradeRemoveUnusedPackages:
43     default: false
44     description: Remove package if the service is being disabled during upgrade
45     type: boolean
46
47 conditions:
48
49   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
50
51 resources:
52
53   ContainersCommon:
54     type: ./containers-common.yaml
55
56   MySQLClient:
57     type: ../../puppet/services/database/mysql-client.yaml
58
59   BarbicanApiBase:
60     type: ../../puppet/services/barbican-api.yaml
61     properties:
62       EndpointMap: {get_param: EndpointMap}
63       ServiceData: {get_param: ServiceData}
64       ServiceNetMap: {get_param: ServiceNetMap}
65       DefaultPasswords: {get_param: DefaultPasswords}
66       RoleName: {get_param: RoleName}
67       RoleParameters: {get_param: RoleParameters}
68
69 outputs:
70   role_data:
71     description: Role data for the Barbican API role.
72     value:
73       service_name: {get_attr: [BarbicanApiBase, role_data, service_name]}
74       config_settings:
75         map_merge:
76           - get_attr: [BarbicanApiBase, role_data, config_settings]
77           - apache::default_vhost: false
78       logging_source: {get_attr: [BarbicanApiBase, role_data, logging_source]}
79       logging_groups: {get_attr: [BarbicanApiBase, role_data, logging_groups]}
80       step_config: &step_config
81         list_join:
82           - "\n"
83           - - {get_attr: [BarbicanApiBase, role_data, step_config]}
84             - {get_attr: [MySQLClient, role_data, step_config]}
85       service_config_settings: {get_attr: [BarbicanApiBase, role_data, service_config_settings]}
86       # BEGIN DOCKER SETTINGS
87       puppet_config:
88         config_volume: barbican
89         puppet_tags: barbican_api_paste_ini,barbican_config
90         step_config: *step_config
91         config_image: {get_param: DockerBarbicanConfigImage}
92       kolla_config:
93         /var/lib/kolla/config_files/barbican_api.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         # db sync runs before permissions set by kolla_config
102         step_2:
103           barbican_init_logs:
104             image: &barbican_api_image {get_param: DockerBarbicanApiImage}
105             privileged: false
106             user: root
107             volumes:
108               - /var/log/containers/barbican:/var/log/barbican
109             command: ['/bin/bash', '-c', 'chown -R barbican:barbican /var/log/barbican']
110         step_3:
111           barbican_api_db_sync:
112             start_order: 0
113             image: *barbican_api_image
114             net: host
115             detach: false
116             user: root
117             volumes: &barbican_api_volumes
118               list_concat:
119                 - {get_attr: [ContainersCommon, volumes]}
120                 -
121                   - /var/lib/config-data/barbican/etc/barbican/:/etc/barbican/:ro
122                   - /var/log/containers/barbican:/var/log/barbican
123             command: "/usr/bin/bootstrap_host_exec barbican_api su barbican -s /bin/bash -c '/usr/bin/barbican-manage db upgrade'"
124         step_4:
125           barbican_api:
126             image: *barbican_api_image
127             net: host
128             privileged: false
129             restart: always
130             user: root
131             volumes:
132               list_concat:
133                 - {get_attr: [ContainersCommon, volumes]}
134                 -
135                   - /var/lib/kolla/config_files/barbican_api.json:/var/lib/kolla/config_files/config.json:ro
136                   - /var/log/containers/barbican:/var/log/barbican
137                   - /var/lib/config-data/puppet-generated/barbican/:/var/lib/kolla/config_files/src:ro
138                   -
139                     if:
140                       - internal_tls_enabled
141                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
142                       - ''
143                   -
144                     if:
145                       - internal_tls_enabled
146                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
147                       - ''
148             environment:
149               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
150       host_prep_tasks:
151         - name: create persistent logs directory
152           file:
153             path: /var/log/containers/barbican
154             state: directory
155       upgrade_tasks:
156         - name: Stop and disable barbican_api service
157           tags: step2
158           service: name=openstack-barbican-api state=stopped enabled=no
159         - name: Remove openstack-barbican-api package if operator requests it
160           yum: name=openstack-barbican-api state=removed
161           tags: step2
162           ignore_errors: True
163           when: {get_param: UpgradeRemoveUnusedPackages}
164       metadata_settings:
165         get_attr: [BarbicanApiBase, role_data, metadata_settings]