Merge "Add heat api container to run cron purge_deleted"
[apex-tripleo-heat-templates.git] / puppet / services / keystone.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack Keystone service configured with Puppet
5
6 parameters:
7   KeystoneEnableDBPurge:
8     default: true
9     description: |
10         Whether to create cron job for purging soft deleted rows in Keystone database.
11     type: boolean
12   KeystoneSSLCertificate:
13     default: ''
14     description: Keystone certificate for verifying token validity.
15     type: string
16   KeystoneSSLCertificateKey:
17     default: ''
18     description: Keystone key for signing tokens.
19     type: string
20     hidden: true
21   KeystoneNotificationDriver:
22     description: Comma-separated list of Oslo notification drivers used by Keystone
23     default: ['messaging']
24     type: comma_delimited_list
25   KeystoneNotificationFormat:
26     description: The Keystone notification format
27     default: 'basic'
28     type: string
29     constraints:
30       - allowed_values: [ 'basic', 'cadf' ]
31   KeystoneRegion:
32     type: string
33     default: 'regionOne'
34     description: Keystone region for endpoint
35   KeystoneTokenProvider:
36     description: The keystone token format
37     type: string
38     default: 'fernet'
39     constraints:
40       - allowed_values: ['uuid', 'fernet']
41   ServiceData:
42     default: {}
43     description: Dictionary packing service data
44     type: json
45   ServiceNetMap:
46     default: {}
47     description: Mapping of service_name -> network name. Typically set
48                  via parameter_defaults in the resource registry.  This
49                  mapping overrides those in ServiceNetMapDefaults.
50     type: json
51   DefaultPasswords:
52     default: {}
53     type: json
54   RoleName:
55     default: ''
56     description: Role name on which the service is applied
57     type: string
58   RoleParameters:
59     default: {}
60     description: Parameters specific to the role
61     type: json
62   EndpointMap:
63     default: {}
64     description: Mapping of service endpoint -> protocol. Typically set
65                  via parameter_defaults in the resource registry.
66     type: json
67   Debug:
68     type: string
69     default: ''
70     description: Set to True to enable debugging on all services.
71   KeystoneDebug:
72     default: ''
73     description: Set to True to enable debugging Keystone service.
74     type: string
75   AdminEmail:
76     default: 'admin@example.com'
77     description: The email for the keystone admin account.
78     type: string
79     hidden: true
80   AdminPassword:
81     description: The password for the keystone admin account, used for monitoring, querying neutron etc.
82     type: string
83     hidden: true
84   AdminToken:
85     description: The keystone auth secret and db password.
86     type: string
87     hidden: true
88   RabbitPassword:
89     description: The password for RabbitMQ
90     type: string
91     hidden: true
92   RabbitUserName:
93     default: guest
94     description: The username for RabbitMQ
95     type: string
96   RabbitClientUseSSL:
97     default: false
98     description: >
99         Rabbit client subscriber parameter to specify
100         an SSL connection to the RabbitMQ host.
101     type: string
102   RabbitClientPort:
103     default: 5672
104     description: Set rabbit subscriber port, change this if using SSL
105     type: number
106   KeystoneWorkers:
107     type: string
108     description: Set the number of workers for keystone::wsgi::apache
109     default: '%{::os_workers}'
110   MonitoringSubscriptionKeystone:
111     default: 'overcloud-keystone'
112     type: string
113   KeystoneCredential0:
114     type: string
115     description: The first Keystone credential key. Must be a valid key.
116   KeystoneCredential1:
117     type: string
118     description: The second Keystone credential key. Must be a valid key.
119   KeystoneFernetKey0:
120     type: string
121     default: ''
122     description: (DEPRECATED) The first Keystone fernet key. Must be a valid key.
123   KeystoneFernetKey1:
124     type: string
125     default: ''
126     description: (DEPRECATED) The second Keystone fernet key. Must be a valid key.
127   KeystoneFernetKeys:
128     type: json
129     description: Mapping containing keystone's fernet keys and their paths.
130   KeystoneFernetMaxActiveKeys:
131     type: number
132     description: The maximum active keys in the keystone fernet key repository.
133     default: 5
134   ManageKeystoneFernetKeys:
135     type: boolean
136     default: true
137     description: Whether TripleO should manage the keystone fernet keys or not.
138                  If set to true, the fernet keys will get the values from the
139                  saved keys repository in mistral (the KeystoneFernetKeys
140                  variable). If set to false, only the stack creation
141                  initializes the keys, but subsequent updates won't touch them.
142   KeystoneLoggingSource:
143     type: json
144     default:
145       tag: openstack.keystone
146       path: /var/log/keystone/keystone.log
147   EnableInternalTLS:
148     type: boolean
149     default: false
150   KeystoneCronTokenFlushEnsure:
151     type: string
152     description: >
153         Cron to purge expired tokens - Ensure
154     default: 'present'
155   KeystoneCronTokenFlushMinute:
156     type: comma_delimited_list
157     description: >
158         Cron to purge expired tokens - Minute
159     default: '1'
160   KeystoneCronTokenFlushHour:
161     type: comma_delimited_list
162     description: >
163         Cron to purge expired tokens - Hour
164     default: '*'
165   KeystoneCronTokenFlushMonthday:
166     type: comma_delimited_list
167     description: >
168         Cron to purge expired tokens - Month Day
169     default: '*'
170   KeystoneCronTokenFlushMonth:
171     type: comma_delimited_list
172     description: >
173         Cron to purge expired tokens - Month
174     default: '*'
175   KeystoneCronTokenFlushWeekday:
176     type: comma_delimited_list
177     description: >
178         Cron to purge expired tokens - Week Day
179     default: '*'
180   KeystoneCronTokenFlushMaxDelay:
181     type: string
182     description: >
183         Cron to purge expired tokens - Max Delay
184     default: '0'
185   KeystoneCronTokenFlushDestination:
186     type: string
187     description: >
188         Cron to purge expired tokens - Log destination
189     default: '/var/log/keystone/keystone-tokenflush.log'
190   KeystoneCronTokenFlushUser:
191     type: string
192     description: >
193         Cron to purge expired tokens - User
194     default: 'keystone'
195   KeystonePolicies:
196     description: |
197       A hash of policies to configure for Keystone.
198       e.g. { keystone-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
199     default: {}
200     type: json
201   KeystoneLDAPDomainEnable:
202     description: Trigger to call ldap_backend puppet keystone define.
203     type: boolean
204     default: False
205   KeystoneLDAPBackendConfigs:
206     description: Hash containing the configurations for the LDAP backends
207                  configured in keystone.
208     type: json
209     default: {}
210     hidden: true
211   NotificationDriver:
212     type: string
213     default: 'messagingv2'
214     description: Driver or drivers to handle sending notifications.
215     constraints:
216       - allowed_values: [ 'messagingv2', 'noop' ]
217
218 parameter_groups:
219 - label: deprecated
220   description: |
221    The following parameters are deprecated and will be removed. They should not
222    be relied on for new deployments. If you have concerns regarding deprecated
223    parameters, please contact the TripleO development team on IRC or the
224    OpenStack mailing list.
225   parameters:
226   - KeystoneFernetKey0
227   - KeystoneFernetKey1
228   - KeystoneNotificationDriver
229
230 resources:
231
232   ApacheServiceBase:
233     type: ./apache.yaml
234     properties:
235       ServiceData: {get_param: ServiceData}
236       ServiceNetMap: {get_param: ServiceNetMap}
237       DefaultPasswords: {get_param: DefaultPasswords}
238       EndpointMap: {get_param: EndpointMap}
239       RoleName: {get_param: RoleName}
240       RoleParameters: {get_param: RoleParameters}
241       EnableInternalTLS: {get_param: EnableInternalTLS}
242
243 conditions:
244   keystone_fernet_tokens: {equals: [{get_param: KeystoneTokenProvider}, "fernet"]}
245   keystone_ldap_domain_enabled: {equals: [{get_param: KeystoneLDAPDomainEnable}, True]}
246   service_debug_unset: {equals : [{get_param: KeystoneDebug}, '']}
247
248 outputs:
249   role_data:
250     description: Role data for the Keystone role.
251     value:
252       service_name: keystone
253       monitoring_subscription: {get_param: MonitoringSubscriptionKeystone}
254       logging_source: {get_param: KeystoneLoggingSource}
255       logging_groups:
256         - keystone
257       config_settings:
258         map_merge:
259           - get_attr: [ApacheServiceBase, role_data, config_settings]
260           - keystone::database_connection:
261               make_url:
262                 scheme: {get_param: [EndpointMap, MysqlInternal, protocol]}
263                 username: keystone
264                 password: {get_param: AdminToken}
265                 host: {get_param: [EndpointMap, MysqlInternal, host]}
266                 path: /keystone
267                 query:
268                   read_default_file: /etc/my.cnf.d/tripleo.cnf
269                   read_default_group: tripleo
270             keystone::admin_token: {get_param: AdminToken}
271             keystone::admin_password: {get_param: AdminPassword}
272             keystone::roles::admin::password: {get_param: AdminPassword}
273             keystone::policy::policies: {get_param: KeystonePolicies}
274             keystone_ssl_certificate: {get_param: KeystoneSSLCertificate}
275             keystone_ssl_certificate_key: {get_param: KeystoneSSLCertificateKey}
276             keystone::token_provider: {get_param: KeystoneTokenProvider}
277             keystone::enable_fernet_setup: {if: [keystone_fernet_tokens, true, false]}
278             keystone::fernet_max_active_keys: {get_param: KeystoneFernetMaxActiveKeys}
279             keystone::enable_proxy_headers_parsing: true
280             keystone::enable_credential_setup: true
281             keystone::credential_keys:
282               '/etc/keystone/credential-keys/0':
283                 content: {get_param: KeystoneCredential0}
284               '/etc/keystone/credential-keys/1':
285                 content: {get_param: KeystoneCredential1}
286             keystone::fernet_keys: {get_param: KeystoneFernetKeys}
287             keystone::fernet_replace_keys: {get_param: ManageKeystoneFernetKeys}
288             keystone::debug:
289               if:
290               - service_debug_unset
291               - {get_param: Debug }
292               - {get_param: KeystoneDebug }
293             keystone::rabbit_userid: {get_param: RabbitUserName}
294             keystone::rabbit_password: {get_param: RabbitPassword}
295             keystone::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
296             keystone::rabbit_port: {get_param: RabbitClientPort}
297             keystone::notification_driver: {get_param: NotificationDriver}
298             keystone::notification_format: {get_param: KeystoneNotificationFormat}
299             keystone::roles::admin::email: {get_param: AdminEmail}
300             keystone::roles::admin::password: {get_param: AdminPassword}
301             keystone::endpoint::public_url: {get_param: [EndpointMap, KeystonePublic, uri_no_suffix]}
302             keystone::endpoint::internal_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
303             keystone::endpoint::admin_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
304             keystone::endpoint::region: {get_param: KeystoneRegion}
305             keystone::endpoint::version: ''
306             keystone_enable_db_purge: {get_param: KeystoneEnableDBPurge}
307             keystone::rabbit_heartbeat_timeout_threshold: 60
308             keystone::cron::token_flush::maxdelay: 3600
309             keystone::roles::admin::service_tenant: 'service'
310             keystone::roles::admin::admin_tenant: 'admin'
311             keystone::cron::token_flush::destination: '/var/log/keystone/keystone-tokenflush.log'
312             keystone::config::keystone_config:
313               ec2/driver:
314                 value: 'keystone.contrib.ec2.backends.sql.Ec2'
315             keystone::service_name: 'httpd'
316             keystone::enable_ssl: {get_param: EnableInternalTLS}
317             keystone::wsgi::apache::ssl: {get_param: EnableInternalTLS}
318             keystone::wsgi::apache::servername:
319               str_replace:
320                 template:
321                   "%{hiera('fqdn_$NETWORK')}"
322                 params:
323                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
324             keystone::wsgi::apache::servername_admin:
325               str_replace:
326                 template:
327                   "%{hiera('fqdn_$NETWORK')}"
328                 params:
329                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
330             keystone::wsgi::apache::workers: {get_param: KeystoneWorkers}
331             # override via extraconfig:
332             keystone::wsgi::apache::threads: 1
333             keystone::db::database_db_max_retries: -1
334             keystone::db::database_max_retries: -1
335             tripleo.keystone.firewall_rules:
336               '111 keystone':
337                 dport:
338                   - 5000
339                   - 13000
340                   - 35357
341                   - 13357
342             keystone::admin_bind_host:
343               str_replace:
344                 template:
345                   "%{hiera('fqdn_$NETWORK')}"
346                 params:
347                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
348             keystone::public_bind_host:
349               str_replace:
350                 template:
351                   "%{hiera('fqdn_$NETWORK')}"
352                 params:
353                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
354             # NOTE: bind IP is found in Heat replacing the network name with the
355             # local node IP for the given network; replacement examples
356             # (eg. for internal_api):
357             # internal_api -> IP
358             # internal_api_uri -> [IP]
359             # internal_api_subnet - > IP/CIDR
360             # NOTE: this applies to all 2 bind IP settings below...
361             keystone::wsgi::apache::bind_host: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
362             keystone::wsgi::apache::admin_bind_host: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
363             keystone::cron::token_flush::ensure: {get_param: KeystoneCronTokenFlushEnsure}
364             keystone::cron::token_flush::minute: {get_param: KeystoneCronTokenFlushMinute}
365             keystone::cron::token_flush::hour: {get_param: KeystoneCronTokenFlushHour}
366             keystone::cron::token_flush::monthday: {get_param: KeystoneCronTokenFlushMonthday}
367             keystone::cron::token_flush::month: {get_param: KeystoneCronTokenFlushMonth}
368             keystone::cron::token_flush::weekday: {get_param: KeystoneCronTokenFlushWeekday}
369             keystone::cron::token_flush::maxdelay: {get_param: KeystoneCronTokenFlushMaxDelay}
370             keystone::cron::token_flush::destination: {get_param: KeystoneCronTokenFlushDestination}
371             keystone::cron::token_flush::user: {get_param: KeystoneCronTokenFlushUser}
372           -
373             if:
374             - keystone_ldap_domain_enabled
375             -
376               tripleo::profile::base::keystone::ldap_backend_enable: True
377               keystone::using_domain_config: True
378               tripleo::profile::base::keystone::ldap_backends_config:
379                 get_param: KeystoneLDAPBackendConfigs
380             - {}
381
382       step_config: |
383         include ::tripleo::profile::base::keystone
384       service_config_settings:
385         mysql:
386           keystone::db::mysql::password: {get_param: AdminToken}
387           keystone::db::mysql::user: keystone
388           keystone::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
389           keystone::db::mysql::dbname: keystone
390           keystone::db::mysql::allowed_hosts:
391             - '%'
392             - "%{hiera('mysql_bind_host')}"
393         horizon:
394           if:
395           - keystone_ldap_domain_enabled
396           -
397             horizon::keystone_multidomain_support: true
398             horizon::keystone_default_domain: 'Default'
399           - {}
400       metadata_settings:
401         get_attr: [ApacheServiceBase, role_data, metadata_settings]
402       upgrade_tasks:
403         yaql:
404           expression: $.data.apache_upgrade + $.data.keystone_upgrade
405           data:
406             apache_upgrade:
407               get_attr: [ApacheServiceBase, role_data, upgrade_tasks]
408             keystone_upgrade:
409               - name: Stop keystone service (running under httpd)
410                 tags: step1
411                 service: name=httpd state=stopped