Merge "Pass the DOCKER_* env vars when running docker"
[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: 'uuid'
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
162 resources:
163
164   ApacheServiceBase:
165     type: ./apache.yaml
166     properties:
167       ServiceNetMap: {get_param: ServiceNetMap}
168       DefaultPasswords: {get_param: DefaultPasswords}
169       EndpointMap: {get_param: EndpointMap}
170       EnableInternalTLS: {get_param: EnableInternalTLS}
171
172 conditions:
173   keystone_fernet_tokens: {equals: [{get_param: KeystoneTokenProvider}, "fernet"]}
174
175 outputs:
176   role_data:
177     description: Role data for the Keystone role.
178     value:
179       service_name: keystone
180       monitoring_subscription: {get_param: MonitoringSubscriptionKeystone}
181       logging_source: {get_param: KeystoneLoggingSource}
182       logging_groups:
183         - keystone
184       config_settings:
185         map_merge:
186           - get_attr: [ApacheServiceBase, role_data, config_settings]
187           - keystone::database_connection:
188               list_join:
189                 - ''
190                 - - {get_param: [EndpointMap, MysqlInternal, protocol]}
191                   - '://keystone:'
192                   - {get_param: AdminToken}
193                   - '@'
194                   - {get_param: [EndpointMap, MysqlInternal, host]}
195                   - '/keystone'
196                   - '?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo'
197             keystone::admin_token: {get_param: AdminToken}
198             keystone::admin_password: {get_param: AdminPassword}
199             keystone::roles::admin::password: {get_param: AdminPassword}
200             keystone_ssl_certificate: {get_param: KeystoneSSLCertificate}
201             keystone_ssl_certificate_key: {get_param: KeystoneSSLCertificateKey}
202             keystone::token_provider: {get_param: KeystoneTokenProvider}
203             keystone::enable_fernet_setup: {if: [keystone_fernet_tokens, true, false]}
204             keystone::enable_proxy_headers_parsing: true
205             keystone::enable_credential_setup: true
206             keystone::credential_keys:
207               '/etc/keystone/credential-keys/0':
208                 content: {get_param: KeystoneCredential0}
209               '/etc/keystone/credential-keys/1':
210                 content: {get_param: KeystoneCredential1}
211             keystone::fernet_keys:
212               '/etc/keystone/fernet-keys/0':
213                 content: {get_param: KeystoneFernetKey0}
214               '/etc/keystone/fernet-keys/1':
215                 content: {get_param: KeystoneFernetKey1}
216             keystone::debug: {get_param: Debug}
217             keystone::rabbit_userid: {get_param: RabbitUserName}
218             keystone::rabbit_password: {get_param: RabbitPassword}
219             keystone::rabbit_use_ssl: {get_param: RabbitClientUseSSL}
220             keystone::rabbit_port: {get_param: RabbitClientPort}
221             keystone::notification_driver: {get_param: KeystoneNotificationDriver}
222             keystone::notification_format: {get_param: KeystoneNotificationFormat}
223             keystone::roles::admin::email: {get_param: AdminEmail}
224             keystone::roles::admin::password: {get_param: AdminPassword}
225             keystone::endpoint::public_url: {get_param: [EndpointMap, KeystonePublic, uri_no_suffix]}
226             keystone::endpoint::internal_url: {get_param: [EndpointMap, KeystoneInternal, uri_no_suffix]}
227             keystone::endpoint::admin_url: {get_param: [EndpointMap, KeystoneAdmin, uri_no_suffix]}
228             keystone::endpoint::region: {get_param: KeystoneRegion}
229             keystone::endpoint::version: ''
230             keystone_enable_db_purge: {get_param: KeystoneEnableDBPurge}
231             keystone::rabbit_heartbeat_timeout_threshold: 60
232             keystone::cron::token_flush::maxdelay: 3600
233             keystone::roles::admin::service_tenant: 'service'
234             keystone::roles::admin::admin_tenant: 'admin'
235             keystone::cron::token_flush::destination: '/var/log/keystone/keystone-tokenflush.log'
236             keystone::config::keystone_config:
237               ec2/driver:
238                 value: 'keystone.contrib.ec2.backends.sql.Ec2'
239             keystone::service_name: 'httpd'
240             keystone::enable_ssl: {get_param: EnableInternalTLS}
241             keystone::wsgi::apache::ssl: {get_param: EnableInternalTLS}
242             keystone::wsgi::apache::servername:
243               str_replace:
244                 template:
245                   "%{hiera('fqdn_$NETWORK')}"
246                 params:
247                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
248             keystone::wsgi::apache::servername_admin:
249               str_replace:
250                 template:
251                   "%{hiera('fqdn_$NETWORK')}"
252                 params:
253                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
254             keystone::wsgi::apache::workers: {get_param: KeystoneWorkers}
255             # override via extraconfig:
256             keystone::wsgi::apache::threads: 1
257             keystone::db::database_db_max_retries: -1
258             keystone::db::database_max_retries: -1
259             tripleo.keystone.firewall_rules:
260               '111 keystone':
261                 dport:
262                   - 5000
263                   - 13000
264                   - 35357
265                   - 13357
266             keystone::admin_bind_host:
267               str_replace:
268                 template:
269                   "%{hiera('fqdn_$NETWORK')}"
270                 params:
271                   $NETWORK: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
272             keystone::public_bind_host:
273               str_replace:
274                 template:
275                   "%{hiera('fqdn_$NETWORK')}"
276                 params:
277                   $NETWORK: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
278             # NOTE: bind IP is found in Heat replacing the network name with the
279             # local node IP for the given network; replacement examples
280             # (eg. for internal_api):
281             # internal_api -> IP
282             # internal_api_uri -> [IP]
283             # internal_api_subnet - > IP/CIDR
284             # NOTE: this applies to all 2 bind IP settings below...
285             keystone::wsgi::apache::bind_host: {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}
286             keystone::wsgi::apache::admin_bind_host: {get_param: [ServiceNetMap, KeystoneAdminApiNetwork]}
287             keystone::cron::token_flush::ensure: {get_param: KeystoneCronTokenFlushEnsure}
288             keystone::cron::token_flush::minute: {get_param: KeystoneCronTokenFlushMinute}
289             keystone::cron::token_flush::hour: {get_param: KeystoneCronTokenFlushHour}
290             keystone::cron::token_flush::monthday: {get_param: KeystoneCronTokenFlushMonthday}
291             keystone::cron::token_flush::month: {get_param: KeystoneCronTokenFlushMonth}
292             keystone::cron::token_flush::weekday: {get_param: KeystoneCronTokenFlushWeekday}
293             keystone::cron::token_flush::maxdelay: {get_param: KeystoneCronTokenFlushMaxDelay}
294             keystone::cron::token_flush::destination: {get_param: KeystoneCronTokenFlushDestination}
295             keystone::cron::token_flush::user: {get_param: KeystoneCronTokenFlushUser}
296
297       step_config: |
298         include ::tripleo::profile::base::keystone
299       service_config_settings:
300         mysql:
301           keystone::db::mysql::password: {get_param: AdminToken}
302           keystone::db::mysql::user: keystone
303           keystone::db::mysql::host: {get_param: [EndpointMap, MysqlInternal, host_nobrackets]}
304           keystone::db::mysql::dbname: keystone
305           keystone::db::mysql::allowed_hosts:
306             - '%'
307             - "%{hiera('mysql_bind_host')}"
308       # Ansible tasks to handle upgrade
309       upgrade_tasks:
310         - name: Stop keystone service (running under httpd)
311           tags: step1
312           service: name=httpd state=stopped
313       metadata_settings:
314         get_attr: [ApacheServiceBase, role_data, metadata_settings]