Merge "Make ceilometer crontab removal idempotent"
[apex-tripleo-heat-templates.git] / docker / services / glance-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Glance service configured with Puppet
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerGlanceApiImage:
12     description: image
13     default: 'centos-binary-glance-api:latest'
14     type: string
15   DockerGlanceApiConfigImage:
16     description: The container image to use for the glance_api config_volume
17     default: 'centos-binary-glance-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
50 resources:
51
52   ContainersCommon:
53     type: ./containers-common.yaml
54
55   GlanceApiPuppetBase:
56     type: ../../puppet/services/glance-api.yaml
57     properties:
58       EndpointMap: {get_param: EndpointMap}
59       ServiceNetMap: {get_param: ServiceNetMap}
60       DefaultPasswords: {get_param: DefaultPasswords}
61       RoleName: {get_param: RoleName}
62       RoleParameters: {get_param: RoleParameters}
63
64 outputs:
65   role_data:
66     description: Role data for the Glance API role.
67     value:
68       service_name: {get_attr: [GlanceApiPuppetBase, role_data, service_name]}
69       config_settings:
70         map_merge:
71           - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
72           - glance::api::sync_db: false
73       step_config: &step_config
74         get_attr: [GlanceApiPuppetBase, role_data, step_config]
75       service_config_settings: {get_attr: [GlanceApiPuppetBase, role_data, service_config_settings]}
76       # BEGIN DOCKER SETTINGS #
77       puppet_config:
78         config_volume: glance_api
79         puppet_tags: glance_api_config,glance_api_paste_ini,glance_swift_config,glance_cache_config
80         step_config: *step_config
81         config_image:
82           list_join:
83             - '/'
84             - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiConfigImage} ]
85       kolla_config:
86         /var/lib/kolla/config_files/glance_api.json:
87           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
88         /var/lib/kolla/config_files/glance_api_tls_proxy.json:
89           command: /usr/sbin/httpd -DFOREGROUND
90       docker_config:
91         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
92         step_2:
93           glance_init_logs:
94             image: &glance_api_image
95               list_join:
96                 - '/'
97                 - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiImage} ]
98             privileged: false
99             user: root
100             volumes:
101               - /var/log/containers/glance:/var/log/glance
102             command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
103         step_3:
104           glance_api_db_sync:
105             image: *glance_api_image
106             net: host
107             privileged: false
108             detach: false
109             user: root
110             volumes: &glance_volumes
111               list_concat:
112                 - {get_attr: [ContainersCommon, volumes]}
113                 -
114                   - /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
115                   - /var/lib/config-data/glance_api/etc/glance/:/etc/glance/:ro
116                   - /var/log/containers/glance:/var/log/glance
117             environment:
118               - KOLLA_BOOTSTRAP=True
119               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
120             command: "/usr/bin/bootstrap_host_exec glance_api su glance -s /bin/bash -c '/usr/local/bin/kolla_start'"
121         step_4:
122           map_merge:
123             - glance_api:
124                 start_order: 2
125                 image: *glance_api_image
126                 net: host
127                 privileged: false
128                 restart: always
129                 volumes: *glance_volumes
130                 environment:
131                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
132             - if:
133                 - internal_tls_enabled
134                 - glance_api_tls_proxy:
135                     start_order: 2
136                     image: *glance_api_image
137                     net: host
138                     user: root
139                     restart: always
140                     volumes:
141                       list_concat:
142                         - {get_attr: [ContainersCommon, volumes]}
143                         -
144                           - /var/lib/kolla/config_files/glance_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
145                           - /var/lib/config-data/glance_api/etc/httpd/conf/:/etc/httpd/conf/:ro
146                           - /var/lib/config-data/glance_api/etc/httpd/conf.d/:/etc/httpd/conf.d/:ro
147                           - /var/lib/config-data/glance_api/etc/httpd/conf.modules.d/:/etc/httpd/conf.modules.d/:ro
148                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
149                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
150                     environment:
151                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
152                 - {}
153       host_prep_tasks:
154         - name: create persistent logs directory
155           file:
156             path: /var/log/containers/glance
157             state: directory
158       upgrade_tasks:
159         - name: Stop and disable glance_api service
160           tags: step2
161           service: name=openstack-glance-api state=stopped enabled=no
162       metadata_settings:
163         get_attr: [GlanceApiPuppetBase, role_data, metadata_settings]