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