514d2f8d4e0270848acf85e654ff30a89e17b265
[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   EndpointMap:
16     default: {}
17     description: Mapping of service endpoint -> protocol. Typically set
18                  via parameter_defaults in the resource registry.
19     type: json
20   ServiceNetMap:
21     default: {}
22     description: Mapping of service_name -> network name. Typically set
23                  via parameter_defaults in the resource registry.  This
24                  mapping overrides those in ServiceNetMapDefaults.
25     type: json
26   DefaultPasswords:
27     default: {}
28     type: json
29   EnableInternalTLS:
30     type: boolean
31     default: false
32
33 conditions:
34
35   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
36
37 resources:
38
39   ContainersCommon:
40     type: ./containers-common.yaml
41
42   GlanceApiPuppetBase:
43     type: ../../puppet/services/glance-api.yaml
44     properties:
45       EndpointMap: {get_param: EndpointMap}
46       ServiceNetMap: {get_param: ServiceNetMap}
47       DefaultPasswords: {get_param: DefaultPasswords}
48
49 outputs:
50   role_data:
51     description: Role data for the Glance API role.
52     value:
53       service_name: {get_attr: [GlanceApiPuppetBase, role_data, service_name]}
54       config_settings:
55         map_merge:
56           - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
57           - glance::api::sync_db: false
58       step_config: &step_config
59         get_attr: [GlanceApiPuppetBase, role_data, step_config]
60       service_config_settings: {get_attr: [GlanceApiPuppetBase, role_data, service_config_settings]}
61       # BEGIN DOCKER SETTINGS #
62       puppet_config:
63         config_volume: glance_api
64         puppet_tags: glance_api_config,glance_api_paste_ini,glance_swift_config,glance_cache_config
65         step_config: *step_config
66         config_image: &glance_image
67           list_join:
68             - '/'
69             - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiImage} ]
70       kolla_config:
71         /var/lib/kolla/config_files/glance-api.json:
72           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
73         /var/lib/kolla/config_files/glance_api_tls_proxy.json:
74           command: /usr/sbin/httpd -DFOREGROUND
75       docker_config:
76         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
77         step_3:
78           glance_init_logs:
79             start_order: 0
80             image: *glance_image
81             privileged: false
82             user: root
83             volumes:
84               - /var/log/containers/glance:/var/log/glance
85             command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
86           glance_api_db_sync:
87             start_order: 1
88             image: *glance_image
89             net: host
90             privileged: false
91             detach: false
92             volumes: &glance_volumes
93               list_concat:
94                 - {get_attr: [ContainersCommon, volumes]}
95                 -
96                   - /var/lib/kolla/config_files/glance-api.json:/var/lib/kolla/config_files/config.json
97                   - /var/lib/config-data/glance_api/etc/glance/:/etc/glance/:ro
98                   - /var/log/containers/glance:/var/log/glance
99             environment:
100               - KOLLA_BOOTSTRAP=True
101               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
102         step_4:
103           map_merge:
104             - glance_api:
105                 start_order: 2
106                 image: *glance_image
107                 net: host
108                 privileged: false
109                 restart: always
110                 volumes: *glance_volumes
111                 environment:
112                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
113             - if:
114                 - internal_tls_enabled
115                 - glance_api_tls_proxy:
116                     start_order: 2
117                     image: *glance_image
118                     net: host
119                     user: root
120                     restart: always
121                     volumes:
122                       list_concat:
123                         - {get_attr: [ContainersCommon, volumes]}
124                         -
125                           - /var/lib/kolla/config_files/glance_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
126                           - /var/lib/config-data/glance_api/etc/httpd/:/etc/httpd/:ro
127                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
128                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
129                     environment:
130                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
131                 - {}
132       host_prep_tasks:
133         - name: create persistent logs directory
134           file:
135             path: /var/log/containers/glance
136             state: directory
137       upgrade_tasks:
138         - name: Stop and disable glance_api service
139           tags: step2
140           service: name=openstack-glance-api state=stopped enabled=no