Merge "Make ceilometer crontab removal idempotent"
[apex-tripleo-heat-templates.git] / docker / services / cinder-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Cinder API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerCinderApiImage:
12     description: image
13     default: 'centos-binary-cinder-api:latest'
14     type: string
15   DockerCinderConfigImage:
16     description: The container image to use for the cinder config_volume
17     default: 'centos-binary-cinder-api: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   CinderBase:
55     type: ../../puppet/services/cinder-api.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 Cinder API role.
66     value:
67       service_name: {get_attr: [CinderBase, role_data, service_name]}
68       config_settings: {get_attr: [CinderBase, role_data, config_settings]}
69       step_config: &step_config
70         get_attr: [CinderBase, role_data, step_config]
71       service_config_settings: {get_attr: [CinderBase, role_data, service_config_settings]}
72       # BEGIN DOCKER SETTINGS
73       puppet_config:
74         config_volume: cinder
75         puppet_tags: cinder_config,file,concat,file_line
76         step_config: *step_config
77         config_image:
78           list_join:
79             - '/'
80             - [ {get_param: DockerNamespace}, {get_param: DockerCinderConfigImage} ]
81       kolla_config:
82         /var/lib/kolla/config_files/cinder_api.json:
83           command: /usr/sbin/httpd -DFOREGROUND
84           permissions:
85             - path: /var/log/cinder
86               owner: cinder:cinder
87               recurse: true
88       docker_config:
89         step_2:
90           cinder_api_init_logs:
91             image: &cinder_api_image
92               list_join:
93                 - '/'
94                 - [ {get_param: DockerNamespace}, {get_param: DockerCinderApiImage} ]
95             privileged: false
96             user: root
97             volumes:
98               - /var/log/containers/cinder:/var/log/cinder
99             command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
100         step_3:
101           cinder_api_db_sync:
102             image: *cinder_api_image
103             net: host
104             privileged: false
105             detach: false
106             user: root
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/config-data/cinder/etc/cinder/:/etc/cinder/:ro
112                   - /var/log/containers/cinder:/var/log/cinder
113             command:
114               - '/usr/bin/bootstrap_host_exec'
115               - 'cinder_api'
116               - "su cinder -s /bin/bash -c 'cinder-manage db sync'"
117         step_4:
118           cinder_api:
119             image: *cinder_api_image
120             net: host
121             privileged: false
122             restart: always
123             # NOTE(mandre) kolla image changes the user to 'cinder', we need it
124             # to be root to run httpd
125             user: root
126             volumes:
127               list_concat:
128                 - {get_attr: [ContainersCommon, volumes]}
129                 -
130                   - /var/lib/kolla/config_files/cinder_api.json:/var/lib/kolla/config_files/config.json:ro
131                   - /var/lib/config-data/cinder/etc/cinder/:/etc/cinder/:ro
132                   - /var/lib/config-data/cinder/etc/httpd/:/etc/httpd/:ro
133                   - /var/lib/config-data/cinder/var/www/:/var/www/:ro
134                   - /var/log/containers/cinder:/var/log/cinder
135                   -
136                     if:
137                       - internal_tls_enabled
138                       - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
139                       - ''
140                   -
141                     if:
142                       - internal_tls_enabled
143                       - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
144                       - ''
145             environment:
146               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
147       host_prep_tasks:
148         - name: create persistent logs directory
149           file:
150             path: /var/log/containers/cinder
151             state: directory
152       upgrade_tasks:
153         - name: Stop and disable cinder_api service
154           tags: step2
155           service: name=httpd state=stopped enabled=no