Merge "Allow to set Notification Driver to 'noop'"
[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   GlanceDebug:
34     default: ''
35     description: Set to True to enable debugging Glance service.
36     type: string
37   GlancePassword:
38     description: The password for the glance service and db account, used by the glance services.
39     type: string
40     hidden: true
41   GlanceWorkers:
42     default: ''
43     description: |
44       Number of API worker processes for Glance. If left unset (empty string), the
45       default value will result in the configuration being left unset and a
46       system-dependent default value will be chosen (e.g.: number of
47       processors). Please note that this will create a large number of
48       processes on systems with a large number of CPUs resulting in excess
49       memory consumption. It is recommended that a suitable non-default value
50       be selected on such systems.
51     type: string
52   MonitoringSubscriptionGlanceApi:
53     default: 'overcloud-glance-api'
54     type: string
55   GlanceApiLoggingSource:
56     type: json
57     default:
58       tag: openstack.glance.api
59       path: /var/log/glance/api.log
60   EnableInternalTLS:
61     type: boolean
62     default: false
63   CephClientUserName:
64     default: openstack
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   NovaEnableRbdBackend:
100     default: false
101     description: Whether to enable or not the Rbd backend for Nova
102     type: boolean
103   RabbitPassword:
104     description: The password for RabbitMQ
105     type: string
106     hidden: true
107   RabbitUserName:
108     default: guest
109     description: The username for RabbitMQ
110     type: string
111   RabbitClientPort:
112     default: 5672
113     description: Set rabbit subscriber port, change this if using SSL
114     type: number
115   RabbitClientUseSSL:
116     default: false
117     description: >
118         Rabbit client subscriber parameter to specify
119         an SSL connection to the RabbitMQ host.
120     type: string
121   KeystoneRegion:
122     type: string
123     default: 'regionOne'
124     description: Keystone region for endpoint
125   GlanceApiPolicies:
126     description: |
127       A hash of policies to configure for Glance API.
128       e.g. { glance-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
129     default: {}
130     type: json
131   NotificationDriver:
132     type: string
133     default: 'messagingv2'
134     description: Driver or drivers to handle sending notifications.
135     constraints:
136       - allowed_values: [ 'messagingv2', 'noop' ]
137
138 conditions:
139   use_tls_proxy: {equals : [{get_param: EnableInternalTLS}, true]}
140   glance_workers_unset: {equals : [{get_param: GlanceWorkers}, '']}
141   service_debug_unset: {equals : [{get_param: GlanceDebug}, '']}
142   glance_multiple_locations:
143     and:
144     - equals:
145       - get_param: GlanceBackend
146       - rbd
147     - equals:
148       - get_param: NovaEnableRbdBackend
149       - true
150
151 resources:
152
153   TLSProxyBase:
154     type: OS::TripleO::Services::TLSProxyBase
155     properties:
156       ServiceNetMap: {get_param: ServiceNetMap}
157       DefaultPasswords: {get_param: DefaultPasswords}
158       EndpointMap: {get_param: EndpointMap}
159       RoleName: {get_param: RoleName}
160       RoleParameters: {get_param: RoleParameters}
161       EnableInternalTLS: {get_param: EnableInternalTLS}
162
163 outputs:
164   role_data:
165     description: Role data for the Glance API role.
166     value:
167       service_name: glance_api
168       monitoring_subscription: {get_param: MonitoringSubscriptionGlanceApi}
169       logging_source: {get_param: GlanceApiLoggingSource}
170       logging_groups:
171         - glance
172       config_settings:
173         map_merge:
174           - get_attr: [TLSProxyBase, role_data, config_settings]
175           - glance::api::database_connection:
176               make_url:
177                 scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
178                 username: glance
179                 password: {get_param: GlancePassword}
180                 host: {get_param: [EndpointMap, MysqlInternal, host]}
181                 path: /glance
182                 query:
183                   read_default_file: /etc/my.cnf.d/tripleo.cnf
184                   read_default_group: tripleo
185             glance::api::bind_port: {get_param: [EndpointMap, GlanceInternal, port]}
186             glance::api::authtoken::auth_uri: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
187             glance::api::authtoken::auth_url: { get_param: [EndpointMap, KeystoneInternal, uri_no_suffix] }
188             glance::api::enable_v1_api: false
189             glance::api::enable_v2_api: true
190             glance::api::authtoken::password: {get_param: GlancePassword}
191             glance::api::enable_proxy_headers_parsing: true
192             glance::api::debug:
193               if:
194               - service_debug_unset
195               - {get_param: Debug }
196               - {get_param: GlanceDebug }
197             glance::policy::policies: {get_param: GlanceApiPolicies}
198             tripleo.glance_api.firewall_rules:
199               '112 glance_api':
200                 dport:
201                   - 9292
202                   - 13292
203             glance::api::authtoken::project_name: 'service'
204             glance::keystone::authtoken::user_domain_name: 'Default'
205             glance::keystone::authtoken::project_domain_name: 'Default'
206             glance::api::pipeline: 'keystone'
207             glance::api::show_image_direct_url: true
208             glance::api::show_multiple_locations: {if: [glance_multiple_locations, true, false]}
209             # NOTE: bind IP is found in Heat replacing the network name with the
210             # local node IP for the given network; replacement examples
211             # (eg. for internal_api):
212             # internal_api -> IP
213             # internal_api_uri -> [IP]
214             # internal_api_subnet - > IP/CIDR
215             tripleo::profile::base::glance::api::tls_proxy_bind_ip:
216               get_param: [ServiceNetMap, GlanceApiNetwork]
217             tripleo::profile::base::glance::api::tls_proxy_fqdn:
218               str_replace:
219                 template:
220                   "%{hiera('fqdn_$NETWORK')}"
221                 params:
222                   $NETWORK: {get_param: [ServiceNetMap, GlanceApiNetwork]}
223             tripleo::profile::base::glance::api::tls_proxy_port:
224               get_param: [EndpointMap, GlanceInternal, port]
225             # Bind to localhost if internal TLS is enabled, since we put a TLs
226             # proxy in front.
227             glance::api::bind_host:
228               if:
229               - use_tls_proxy
230               - 'localhost'
231               - {get_param: [ServiceNetMap, GlanceApiNetwork]}
232             glance_notifier_strategy: {get_param: GlanceNotifierStrategy}
233             glance_log_file: {get_param: GlanceLogFile}
234             glance::backend::swift::swift_store_auth_address: {get_param: [EndpointMap, KeystoneV3Internal, uri] }
235             glance::backend::swift::swift_store_user: service:glance
236             glance::backend::swift::swift_store_key: {get_param: GlancePassword}
237             glance::backend::swift::swift_store_create_container_on_put: true
238             glance::backend::swift::swift_store_auth_version: 3
239             glance::backend::rbd::rbd_store_pool: {get_param: GlanceRbdPoolName}
240             glance::backend::rbd::rbd_store_user: {get_param: CephClientUserName}
241             glance_backend: {get_param: GlanceBackend}
242             glance::notify::rabbitmq::rabbit_userid: {get_param: RabbitUserName}
243             glance::notify::rabbitmq::rabbit_port: {get_param: RabbitClientPort}
244             glance::notify::rabbitmq::rabbit_password: {get_param: RabbitPassword}
245             glance::notify::rabbitmq::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
246             glance::notify::rabbitmq::notification_driver: {get_param: NotificationDriver}
247             tripleo::profile::base::glance::api::glance_nfs_enabled: {get_param: GlanceNfsEnabled}
248             tripleo::glance::nfs_mount::share: {get_param: GlanceNfsShare}
249             tripleo::glance::nfs_mount::options: {get_param: GlanceNfsOptions}
250           -
251             if:
252             - glance_workers_unset
253             - {}
254             - glance::api::workers: {get_param: GlanceWorkers}
255       service_config_settings:
256         keystone:
257           glance::keystone::auth::public_url: {get_param: [EndpointMap, GlancePublic, uri]}
258           glance::keystone::auth::internal_url: {get_param: [EndpointMap, GlanceInternal, uri]}
259           glance::keystone::auth::admin_url: {get_param: [EndpointMap, GlanceAdmin, uri]}
260           glance::keystone::auth::password: {get_param: GlancePassword }
261           glance::keystone::auth::region: {get_param: KeystoneRegion}
262           glance::keystone::auth::tenant: 'service'
263         mysql:
264           glance::db::mysql::password: {get_param: GlancePassword}
265           glance::db::mysql::user: glance
266           glance::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
267           glance::db::mysql::dbname: glance
268           glance::db::mysql::allowed_hosts:
269             - '%'
270             - "%{hiera('mysql_bind_host')}"
271       step_config: |
272         include ::tripleo::profile::base::glance::api
273       upgrade_tasks:
274         - name: Check if glance_api is deployed
275           command: systemctl is-enabled openstack-glance-api
276           tags: common
277           ignore_errors: True
278           register: glance_api_enabled
279         #(TODO) Remove all glance-registry bits in Pike.
280         - name: Check if glance_registry is deployed
281           command: systemctl is-enabled openstack-glance-registry
282           tags: common
283           ignore_errors: True
284           register: glance_registry_enabled
285         - name: "PreUpgrade step0,validation: Check service openstack-glance-api is running"
286           shell: /usr/bin/systemctl show 'openstack-glance-api' --property ActiveState | grep '\bactive\b'
287           tags: step0,validation
288           when: glance_api_enabled.rc == 0
289         - name: Stop glance_api service
290           tags: step1
291           when: glance_api_enabled.rc == 0
292           service: name=openstack-glance-api state=stopped
293         - name: Stop and disable glance registry (removed for Ocata)
294           tags: step1
295           when: glance_registry_enabled.rc == 0
296           service: name=openstack-glance-registry state=stopped enabled=no