Merge "Remove kolla_config copy from services"
[apex-tripleo-heat-templates.git] / puppet / services / keystone.yaml
1 heat_template_version: ocata
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   ServiceNetMap:
42     default: {}
43     description: Mapping of service_name -> network name. Typically set
44                  via parameter_defaults in the resource registry.  This
45                  mapping overrides those in ServiceNetMapDefaults.
46     type: json
47   DefaultPasswords:
48     default: {}
49     type: json
50   EndpointMap:
51     default: {}
52     description: Mapping of service endpoint -> protocol. Typically set
53                  via parameter_defaults in the resource registry.
54     type: json
55   Debug:
56     type: string
57     default: ''
58   AdminEmail:
59     default: 'admin@example.com'
60     description: The email for the keystone admin account.
61     type: string
62     hidden: true
63   AdminPassword:
64     description: The password for the keystone admin account, used for monitoring, querying neutron etc.
65     type: string
66     hidden: true
67   AdminToken:
68     description: The keystone auth secret and db password.
69     type: string
70     hidden: true
71   RabbitPassword:
72     description: The password for RabbitMQ
73     type: string
74     hidden: true
75   RabbitUserName:
76     default: guest
77     description: The username for RabbitMQ
78     type: string
79   RabbitClientUseSSL:
80     default: false
81     description: >
82         Rabbit client subscriber parameter to specify
83         an SSL connection to the RabbitMQ host.
84     type: string
85   RabbitClientPort:
86     default: 5672
87     description: Set rabbit subscriber port, change this if using SSL
88     type: number
89   KeystoneWorkers:
90     type: string
91     description: Set the number of workers for keystone::wsgi::apache
92     default: '%{::os_workers}'
93   MonitoringSubscriptionKeystone:
94     default: 'overcloud-keystone'
95     type: string
96   KeystoneCredential0:
97     type: string
98     description: The first Keystone credential key. Must be a valid key.
99   KeystoneCredential1:
100     type: string
101     description: The second Keystone credential key. Must be a valid key.
102   KeystoneFernetKey0:
103     type: string
104     description: The first Keystone fernet key. Must be a valid key.
105   KeystoneFernetKey1:
106     type: string
107     description: The second Keystone fernet key. Must be a valid key.
108   KeystoneLoggingSource:
109     type: json
110     default:
111       tag: openstack.keystone
112       path: /var/log/keystone/keystone.log
113   EnableInternalTLS:
114     type: boolean
115     default: false
116   KeystoneCronTokenFlushEnsure:
117     type: string
118     description: >
119         Cron to purge expired tokens - Ensure
120     default: 'present'
121   KeystoneCronTokenFlushMinute:
122     type: string
123     description: >
124         Cron to purge expired tokens - Minute
125     default: '1'
126   KeystoneCronTokenFlushHour:
127     type: string
128     description: >
129         Cron to purge expired tokens - Hour
130     default: '0'
131   KeystoneCronTokenFlushMonthday:
132     type: string
133     description: >
134         Cron to purge expired tokens - Month Day
135     default: '*'
136   KeystoneCronTokenFlushMonth:
137     type: string
138     description: >
139         Cron to purge expired tokens - Month
140     default: '*'
141   KeystoneCronTokenFlushWeekday:
142     type: string
143     description: >
144         Cron to purge expired tokens - Week Day
145     default: '*'
146   KeystoneCronTokenFlushMaxDelay:
147     type: string
148     description: >
149         Cron to purge expired tokens - Max Delay
150     default: '0'
151   KeystoneCronTokenFlushDestination:
152     type: string
153     description: >
154         Cron to purge expired tokens - Log destination
155     default: '/var/log/keystone/keystone-tokenflush.log'
156   KeystoneCronTokenFlushUser:
157     type: string
158     description: >
159         Cron to purge expired tokens - User
160     default: 'keystone'
161   KeystonePolicies:
162     description: |
163       A hash of policies to configure for Keystone.
164       e.g. { keystone-context_is_admin: { key: context_is_admin, value: 'role:admin' } }
165     default: {}
166     type: json
167
168 resources:
169
170   ApacheServiceBase:
171     type: ./apache.yaml
172     properties:
173       ServiceNetMap: {get_param: ServiceNetMap}
174       DefaultPasswords: {get_param: DefaultPasswords}
175       EndpointMap: {get_param: EndpointMap}
176       EnableInternalTLS: {get_param: EnableInternalTLS}
177
178 conditions:
179   keystone_fernet_tokens: {equals: [{get_param: KeystoneTokenProvider}, "fernet"]}
180
181 outputs:
182   role_data:
183     description: Role data for the Keystone role.
184     value:
185       service_name: keystone
186       monitoring_subscription: {get_param: MonitoringSubscriptionKeystone}
187       logging_source: {get_param: KeystoneLoggingSource}
188       logging_groups:
189         - keystone
190       config_settings:
191         map_merge:
192           - get_attr: [ApacheServiceBase, role_data, config_settings]
193           - keystone::database_connection:
194               list_join:
195                 - ''
196                 - - {get_param: [EndpointMap, MysqlInternal, protocol]}
197                   - '://keystone:'
198                   - {get_param: AdminToken}
199                   - '@'
200                   - {get_param: [EndpointMap, MysqlInternal, host]}
201                   - '/keystone'
202                   - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
203             keystone::admin_token: {get_param: AdminToken}
204             keystone::admin_password: {get_param: AdminPassword}
205             keystone::roles::admin::password: {get_param: AdminPassword}
206             keystone::policy::policies: {get_param: KeystonePolicies}
207             keystone_ssl_certificate: {get_param: KeystoneSSLCertificate}
208             keystone_ssl_certificate_key: {get_param: KeystoneSSLCertificateKey}
209             keystone::token_provider: {get_param: KeystoneTokenProvider}
210             keystone::enable_fernet_setup: {if: [keystone_fernet_tokens, true, false]}
211             keystone::enable_proxy_headers_parsing: true
212             keystone::enable_credential_setup: true
213             keystone::credential_keys:
214               '/etc/keystone/credential-keys/0':
215                 content: {get_param: KeystoneCredential0}
216               '/etc/keystone/credential-keys/1':
217                 content: {get_param: KeystoneCredential1}
218             keystone::fernet_keys:
219               '/etc/keystone/fernet-keys/0':
220                 content: {get_param: KeystoneFernetKey0}
221               '/etc/keystone/fernet-keys/1':
222                 content: {get_param: KeystoneFernetKey1}
223             keystone::debug: {get_param: Debug}
224             keystone::rabbit_userid: {get_param: RabbitUserName}
225             keystone::rabbit_password: {get_param: RabbitPassword}
226             keystone::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
227             keystone::rabbit_port: {get_param: RabbitClientPort}
228             keystone::notification_driver: {get_param: KeystoneNotificationDriver}
229             keystone::notification_format: {get_param: KeystoneNotificationFormat}
230             keystone::roles::admin::email: {get_param: AdminEmail}
231             keystone::roles::admin::password: {get_param: AdminPassword}
232             keystone::endpoint::public_url: {get_param: [EndpointMap, KeystonePublic, uri_no_suffix]}
233             keystone::endpoint::internal_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
234             keystone::endpoint::admin_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
235             keystone::endpoint::region: {get_param: KeystoneRegion}
236             keystone::endpoint::version: ''
237             keystone_enable_db_purge: {get_param: KeystoneEnableDBPurge}
238             keystone::rabbit_heartbeat_timeout_threshold: 60
239             keystone::cron::token_flush::maxdelay: 3600
240             keystone::roles::admin::service_tenant: 'service'
241             keystone::roles::admin::admin_tenant: 'admin'
242             keystone::cron::token_flush::destination: '/var/log/keystone/keystone-tokenflush.log'
243             keystone::config::keystone_config:
244               ec2/driver:
245                 value: 'keystone.contrib.ec2.backends.sql.Ec2'
246             keystone::service_name: 'httpd'
247             keystone::enable_ssl: {get_param: EnableInternalTLS}
248             keystone::wsgi::apache::ssl: {get_param: EnableInternalTLS}
249             keystone::wsgi::apache::servername:
250               str_replace:
251                 template:
252                   "%{hiera('fqdn_$NETWORK')}"
253                 params:
254                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
255             keystone::wsgi::apache::servername_admin:
256               str_replace:
257                 template:
258                   "%{hiera('fqdn_$NETWORK')}"
259                 params:
260                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
261             keystone::wsgi::apache::workers: {get_param: KeystoneWorkers}
262             # override via extraconfig:
263             keystone::wsgi::apache::threads: 1
264             keystone::db::database_db_max_retries: -1
265             keystone::db::database_max_retries: -1
266             tripleo.keystone.firewall_rules:
267               '111 keystone':
268                 dport:
269                   - 5000
270                   - 13000
271                   - 35357
272                   - 13357
273             keystone::admin_bind_host:
274               str_replace:
275                 template:
276                   "%{hiera('fqdn_$NETWORK')}"
277                 params:
278                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
279             keystone::public_bind_host:
280               str_replace:
281                 template:
282                   "%{hiera('fqdn_$NETWORK')}"
283                 params:
284                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
285             # NOTE: bind IP is found in Heat replacing the network name with the
286             # local node IP for the given network; replacement examples
287             # (eg. for internal_api):
288             # internal_api -> IP
289             # internal_api_uri -> [IP]
290             # internal_api_subnet - > IP/CIDR
291             # NOTE: this applies to all 2 bind IP settings below...
292             keystone::wsgi::apache::bind_host: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
293             keystone::wsgi::apache::admin_bind_host: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
294             keystone::cron::token_flush::ensure: {get_param: KeystoneCronTokenFlushEnsure}
295             keystone::cron::token_flush::minute: {get_param: KeystoneCronTokenFlushMinute}
296             keystone::cron::token_flush::hour: {get_param: KeystoneCronTokenFlushHour}
297             keystone::cron::token_flush::monthday: {get_param: KeystoneCronTokenFlushMonthday}
298             keystone::cron::token_flush::month: {get_param: KeystoneCronTokenFlushMonth}
299             keystone::cron::token_flush::weekday: {get_param: KeystoneCronTokenFlushWeekday}
300             keystone::cron::token_flush::maxdelay: {get_param: KeystoneCronTokenFlushMaxDelay}
301             keystone::cron::token_flush::destination: {get_param: KeystoneCronTokenFlushDestination}
302             keystone::cron::token_flush::user: {get_param: KeystoneCronTokenFlushUser}
303
304       step_config: |
305         include ::tripleo::profile::base::keystone
306       service_config_settings:
307         mysql:
308           keystone::db::mysql::password: {get_param: AdminToken}
309           keystone::db::mysql::user: keystone
310           keystone::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
311           keystone::db::mysql::dbname: keystone
312           keystone::db::mysql::allowed_hosts:
313             - '%'
314             - "%{hiera('mysql_bind_host')}"
315       # Ansible tasks to handle upgrade
316       upgrade_tasks:
317         - name: Stop keystone service (running under httpd)
318           tags: step1
319           service: name=httpd state=stopped
320       metadata_settings:
321         get_attr: [ApacheServiceBase, role_data, metadata_settings]