Merge "aodh: add gnocchi_external_project_owner config"
[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   DockerGlanceApiImage:
8     description: image
9     type: string
10   DockerGlanceApiConfigImage:
11     description: The container image to use for the glance_api 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
48 resources:
49
50   ContainersCommon:
51     type: ./containers-common.yaml
52
53   GlanceApiPuppetBase:
54     type: ../../puppet/services/glance-api.yaml
55     properties:
56       EndpointMap: {get_param: EndpointMap}
57       ServiceData: {get_param: ServiceData}
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 Glance API role.
66     value:
67       service_name: {get_attr: [GlanceApiPuppetBase, role_data, service_name]}
68       config_settings:
69         map_merge:
70           - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
71           - glance::api::sync_db: false
72       step_config: &step_config
73         get_attr: [GlanceApiPuppetBase, role_data, step_config]
74       service_config_settings: {get_attr: [GlanceApiPuppetBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS #
76       puppet_config:
77         config_volume: glance_api
78         puppet_tags: glance_api_config,glance_api_paste_ini,glance_swift_config,glance_cache_config
79         step_config: *step_config
80         config_image: {get_param: DockerGlanceApiConfigImage}
81       kolla_config:
82         /var/lib/kolla/config_files/glance_api.json:
83           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
84           config_files:
85             - source: "/var/lib/kolla/config_files/src/*"
86               dest: "/"
87               merge: true
88               preserve_properties: true
89             - source: "/var/lib/kolla/config_files/src-ceph/"
90               dest: "/etc/ceph/"
91               merge: true
92               preserve_properties: true
93         /var/lib/kolla/config_files/glance_api_tls_proxy.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         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
102         step_2:
103           glance_init_logs:
104             image: &glance_api_image {get_param: DockerGlanceApiImage}
105             privileged: false
106             user: root
107             volumes:
108               - /var/log/containers/glance:/var/log/glance
109             command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
110         step_3:
111           glance_api_db_sync:
112             image: *glance_api_image
113             net: host
114             privileged: false
115             detach: false
116             user: root
117             volumes: &glance_volumes
118               list_concat:
119                 - {get_attr: [ContainersCommon, volumes]}
120                 -
121                   - /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
122                   - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
123                   - /var/log/containers/glance:/var/log/glance
124                   - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
125             environment:
126               - KOLLA_BOOTSTRAP=True
127               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
128             command: "/usr/bin/bootstrap_host_exec glance_api su glance -s /bin/bash -c '/usr/local/bin/kolla_start'"
129         step_4:
130           map_merge:
131             - glance_api:
132                 start_order: 2
133                 image: *glance_api_image
134                 net: host
135                 privileged: false
136                 restart: always
137                 volumes: *glance_volumes
138                 environment:
139                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
140             - if:
141                 - internal_tls_enabled
142                 - glance_api_tls_proxy:
143                     start_order: 2
144                     image: *glance_api_image
145                     net: host
146                     user: root
147                     restart: always
148                     volumes:
149                       list_concat:
150                         - {get_attr: [ContainersCommon, volumes]}
151                         -
152                           - /var/lib/kolla/config_files/glance_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
153                           - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
154                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
155                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
156                     environment:
157                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
158                 - {}
159       host_prep_tasks:
160         - name: create persistent logs directory
161           file:
162             path: /var/log/containers/glance
163             state: directory
164         - name: ensure ceph configurations exist
165           file:
166             path: /etc/ceph
167             state: directory
168       upgrade_tasks:
169         - name: Stop and disable glance_api service
170           tags: step2
171           service: name=openstack-glance-api state=stopped enabled=no
172       metadata_settings:
173         get_attr: [GlanceApiPuppetBase, role_data, metadata_settings]