Merge "Change database sync timeout from 300 to 900 in low-memory-usage environment...
[apex-tripleo-heat-templates.git] / puppet / services / glance-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Glance API service configured with Puppet
5
6 parameters:
7   ServiceNetMap:
8     default: {}
9     description: Mapping of service_name -> network name. Typically set
10                  via parameter_defaults in the resource registry.  This
11                  mapping overrides those in ServiceNetMapDefaults.
12     type: json
13   DefaultPasswords:
14     default: {}
15     type: json
16   RoleName:
17     default: ''
18     description: Role name on which the service is applied
19     type: string
20   RoleParameters:
21     default: {}
22     description: Parameters specific to the role
23     type: json
24   EndpointMap:
25     default: {}
26     description: Mapping of service endpoint -> protocol. Typically set
27                  via parameter_defaults in the resource registry.
28     type: json
29   Debug:
30     default: ''
31     description: Set to True to enable debugging on all services.
32     type: string
33   GlancePassword:
34     description: The password for the glance service and db account, used by the glance services.
35     type: string
36     hidden: true
37   GlanceWorkers:
38     default: ''
39     description: |
40       Number of API worker processes for Glance. If left unset (empty string), the
41       default value will result in the configuration being left unset and a
42       system-dependent default value will be chosen (e.g.: number of
43       processors). Please note that this will create a large number of
44       processes on systems with a large number of CPUs resulting in excess
45       memory consumption. It is recommended that a suitable non-default value
46       be selected on such systems.
47     type: string
48   MonitoringSubscriptionGlanceApi:
49     default: 'overcloud-glance-api'
50     type: string
51   GlanceApiLoggingSource:
52     type: json
53     default:
54       tag: openstack.glance.api
55       path: /var/log/glance/api.log
56   EnableInternalTLS:
57     type: boolean
58     default: false
59   CephClientUserName:
60     default: openstack
61     type: string
62   Debug:
63     default: ''
64     description: Set to True to enable debugging on all services.
65     type: string
66   GlanceNotifierStrategy:
67     description: Strategy to use for Glance notification queue
68     type: string
69     default: noop
70   GlanceLogFile:
71     description: The filepath of the file to use for logging messages from Glance.
72     type: string
73     default: ''
74   GlanceBackend:
75     default: swift
76     description: The short name of the Glance backend to use. Should be one
77       of swift, rbd, or file
78     type: string
79     constraints:
80     - allowed_values: ['swift', 'file', 'rbd']
81   GlanceNfsEnabled:
82     default: false
83     description: >
84       When using GlanceBackend 'file', mount NFS share for image storage.
85     type: boolean
86   GlanceNfsShare:
87     default: ''
88     description: >
89       NFS share to mount for image storage (when GlanceNfsEnabled is true)
90     type: string
91   GlanceNfsOptions:
92     default: 'intr,context=system_u:object_r:glance_var_lib_t:s0'
93     description: >
94       NFS mount options for image storage (when GlanceNfsEnabled is true)
95     type: string
96   GlanceRbdPoolName:
97     default: images
98     type: string
99   RabbitPassword:
100     description: The password for RabbitMQ
101     type: string
102     hidden: true
103   RabbitUserName:
104     default: guest
105     description: The username for RabbitMQ
106     type: string
107   RabbitClientPort:
108     default: 5672
109     description: Set rabbit subscriber port, change this if using SSL
110     type: number
111   RabbitClientUseSSL:
112     default: false
113     description: >
114         Rabbit client subscriber parameter to specify
115         an SSL connection to the RabbitMQ host.
116     type: string
117   KeystoneRegion:
118     type: string
119     default: 'regionOne'
120     description: Keystone region for endpoint
121   GlanceApiPolicies:
122     description: |
123       A hash of policies to configure for Glance API.
124       e.g. { glance-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
125     default: {}
126     type: json
127
128 conditions:
129   use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
130   glance_workers_unset: {equals : [{get_param: GlanceWorkers}, '']}
131
132 resources:
133
134   TLSProxyBase:
135     type: OS::TripleO::Services::TLSProxyBase
136     properties:
137       ServiceNetMap: {get_param: ServiceNetMap}
138       DefaultPasswords: {get_param: DefaultPasswords}
139       EndpointMap: {get_param: EndpointMap}
140       RoleName: {get_param: RoleName}
141       RoleParameters: {get_param: RoleParameters}
142       EnableInternalTLS: {get_param: EnableInternalTLS}
143
144 outputs:
145   role_data:
146     description: Role data for the Glance API role.
147     value:
148       service_name: glance_api
149       monitoring_subscription: {get_param: MonitoringSubscriptionGlanceApi}
150       logging_source: {get_param: GlanceApiLoggingSource}
151       logging_groups:
152         - glance
153       config_settings:
154         map_merge:
155           - get_attr: [TLSProxyBase, role_data, config_settings]
156           - glance::api::database_connection:
157               make_url:
158                 scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
159                 username: glance
160                 password: {get_param: GlancePassword}
161                 host: {get_param: [EndpointMap, MysqlInternal, host]}
162                 path: /glance
163                 query:
164                   read_default_file: /etc/my.cnf.d/tripleo.cnf
165                   read_default_group: tripleo
166             glance::api::bind_port: {get_param: [EndpointMap, GlanceInternal, port]}
167             glance::api::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
168             glance::api::authtoken::auth_url: { get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
169             glance::api::enable_v1_api: false
170             glance::api::enable_v2_api: true
171             glance::api::authtoken::password: {get_param: GlancePassword}
172             glance::api::enable_proxy_headers_parsing: true
173             glance::api::debug: {get_param: Debug}
174             glance::policy::policies: {get_param: GlanceApiPolicies}
175             tripleo.glance_api.firewall_rules:
176               '112 glance_api':
177                 dport:
178                   - 9292
179                   - 13292
180             glance::api::authtoken::project_name: 'service'
181             glance::keystone::authtoken::user_domain_name: 'Default'
182             glance::keystone::authtoken::project_domain_name: 'Default'
183             glance::api::pipeline: 'keystone'
184             glance::api::show_image_direct_url: true
185             # NOTE: bind IP is found in Heat replacing the network name with the
186             # local node IP for the given network; replacement examples
187             # (eg. for internal_api):
188             # internal_api -> IP
189             # internal_api_uri -> [IP]
190             # internal_api_subnet - > IP/CIDR
191             tripleo::profile::base::glance::api::tls_proxy_bind_ip:
192               get_param: [ServiceNetMap, GlanceApiNetwork]
193             tripleo::profile::base::glance::api::tls_proxy_fqdn:
194               str_replace:
195                 template:
196                   "%{hiera('fqdn_$NETWORK')}"
197                 params:
198                   $NETWORK: {get_param: [ServiceNetMap, GlanceApiNetwork]}
199             tripleo::profile::base::glance::api::tls_proxy_port:
200               get_param: [EndpointMap, GlanceInternal, port]
201             # Bind to localhost if internal TLS is enabled, since we put a TLs
202             # proxy in front.
203             glance::api::bind_host:
204               if:
205               - use_tls_proxy
206               - 'localhost'
207               - {get_param: [ServiceNetMap, GlanceApiNetwork]}
208             glance_notifier_strategy: {get_param: GlanceNotifierStrategy}
209             glance_log_file: {get_param: GlanceLogFile}
210             glance::backend::swift::swift_store_auth_address: {get_param: [EndpointMap, KeystoneV3Internal, uri] }
211             glance::backend::swift::swift_store_user: service:glance
212             glance::backend::swift::swift_store_key: {get_param: GlancePassword}
213             glance::backend::swift::swift_store_create_container_on_put: true
214             glance::backend::swift::swift_store_auth_version: 3
215             glance::backend::rbd::rbd_store_pool: {get_param: GlanceRbdPoolName}
216             glance::backend::rbd::rbd_store_user: {get_param: CephClientUserName}
217             glance_backend: {get_param: GlanceBackend}
218             glance::notify::rabbitmq::rabbit_userid: {get_param: RabbitUserName}
219             glance::notify::rabbitmq::rabbit_port: {get_param: RabbitClientPort}
220             glance::notify::rabbitmq::rabbit_password: {get_param: RabbitPassword}
221             glance::notify::rabbitmq::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
222             glance::notify::rabbitmq::notification_driver: messagingv2
223             tripleo::profile::base::glance::api::glance_nfs_enabled: {get_param: GlanceNfsEnabled}
224             tripleo::glance::nfs_mount::share: {get_param: GlanceNfsShare}
225             tripleo::glance::nfs_mount::options: {get_param: GlanceNfsOptions}
226           -
227             if:
228             - glance_workers_unset
229             - {}
230             - glance::api::workers: {get_param: GlanceWorkers}
231       service_config_settings:
232         keystone:
233           glance::keystone::auth::public_url: {get_param: [EndpointMap, GlancePublic, uri]}
234           glance::keystone::auth::internal_url: {get_param: [EndpointMap, GlanceInternal, uri]}
235           glance::keystone::auth::admin_url: {get_param: [EndpointMap, GlanceAdmin, uri]}
236           glance::keystone::auth::password: {get_param: GlancePassword }
237           glance::keystone::auth::region: {get_param: KeystoneRegion}
238           glance::keystone::auth::tenant: 'service'
239         mysql:
240           glance::db::mysql::password: {get_param: GlancePassword}
241           glance::db::mysql::user: glance
242           glance::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
243           glance::db::mysql::dbname: glance
244           glance::db::mysql::allowed_hosts:
245             - '%'
246             - "%{hiera('mysql_bind_host')}"
247       step_config: |
248         include ::tripleo::profile::base::glance::api
249       upgrade_tasks:
250         - name: Check if glance_api is deployed
251           command: systemctl is-enabled openstack-glance-api
252           tags: common
253           ignore_errors: True
254           register: glance_api_enabled
255         #(TODO) Remove all glance-registry bits in Pike.
256         - name: Check if glance_registry is deployed
257           command: systemctl is-enabled openstack-glance-registry
258           tags: common
259           ignore_errors: True
260           register: glance_registry_enabled
261         - name: "PreUpgrade step0,validation: Check service openstack-glance-api is running"
262           shell: /usr/bin/systemctl show 'openstack-glance-api' --property ActiveState | grep '\bactive\b'
263           tags: step0,validation
264           when: glance_api_enabled.rc == 0
265         - name: Stop glance_api service
266           tags: step1
267           when: glance_api_enabled.rc == 0
268           service: name=openstack-glance-api state=stopped
269         - name: Stop and disable glance registry (removed for Ocata)
270           tags: step1
271           when: glance_registry_enabled.rc == 0
272           service: name=openstack-glance-registry state=stopped enabled=no