Merge "Add ComputeHCI role and related validations"
[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         /var/lib/kolla/config_files/glance_api_tls_proxy.json:
90           command: /usr/sbin/httpd -DFOREGROUND
91           config_files:
92             - source: "/var/lib/kolla/config_files/src/*"
93               dest: "/"
94               merge: true
95               preserve_properties: true
96       docker_config:
97         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
98         step_2:
99           glance_init_logs:
100             image: &glance_api_image {get_param: DockerGlanceApiImage}
101             privileged: false
102             user: root
103             volumes:
104               - /var/log/containers/glance:/var/log/glance
105             command: ['/bin/bash', '-c', 'chown -R glance:glance /var/log/glance']
106         step_3:
107           glance_api_db_sync:
108             image: *glance_api_image
109             net: host
110             privileged: false
111             detach: false
112             user: root
113             volumes: &glance_volumes
114               list_concat:
115                 - {get_attr: [ContainersCommon, volumes]}
116                 -
117                   - /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
118                   - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
119                   - /var/log/containers/glance:/var/log/glance
120             environment:
121               - KOLLA_BOOTSTRAP=True
122               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
123             command: "/usr/bin/bootstrap_host_exec glance_api su glance -s /bin/bash -c '/usr/local/bin/kolla_start'"
124         step_4:
125           map_merge:
126             - glance_api:
127                 start_order: 2
128                 image: *glance_api_image
129                 net: host
130                 privileged: false
131                 restart: always
132                 volumes: *glance_volumes
133                 environment:
134                   - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
135             - if:
136                 - internal_tls_enabled
137                 - glance_api_tls_proxy:
138                     start_order: 2
139                     image: *glance_api_image
140                     net: host
141                     user: root
142                     restart: always
143                     volumes:
144                       list_concat:
145                         - {get_attr: [ContainersCommon, volumes]}
146                         -
147                           - /var/lib/kolla/config_files/glance_api_tls_proxy.json:/var/lib/kolla/config_files/config.json:ro
148                           - /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
149                           - /etc/pki/tls/certs/httpd:/etc/pki/tls/certs/httpd:ro
150                           - /etc/pki/tls/private/httpd:/etc/pki/tls/private/httpd:ro
151                     environment:
152                       - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
153                 - {}
154       host_prep_tasks:
155         - name: create persistent logs directory
156           file:
157             path: /var/log/containers/glance
158             state: directory
159       upgrade_tasks:
160         - name: Stop and disable glance_api service
161           tags: step2
162           service: name=openstack-glance-api state=stopped enabled=no
163       metadata_settings:
164         get_attr: [GlanceApiPuppetBase, role_data, metadata_settings]