2015-01-12 13:54:54 -07:00
|
|
|
# == Class: keystone::policy
|
|
|
|
#
|
|
|
|
# Configure the keystone policies
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
2020-10-21 21:06:07 +09:00
|
|
|
# [*enforce_scope*]
|
|
|
|
# (Optional) Whether or not to enforce scope when evaluating policies.
|
2023-03-02 11:10:02 +09:00
|
|
|
# Defaults to $facts['os_service_default'].
|
2020-10-21 21:06:07 +09:00
|
|
|
#
|
2021-03-18 20:57:27 +09:00
|
|
|
# [*enforce_new_defaults*]
|
|
|
|
# (Optional) Whether or not to use old deprecated defaults when evaluating
|
|
|
|
# policies.
|
2023-03-02 11:10:02 +09:00
|
|
|
# Defaults to $facts['os_service_default'].
|
2021-03-18 20:57:27 +09:00
|
|
|
#
|
2015-01-12 13:54:54 -07:00
|
|
|
# [*policies*]
|
2018-12-13 17:10:01 +08:00
|
|
|
# (Optional) Set of policies to configure for keystone
|
2015-01-12 13:54:54 -07:00
|
|
|
# Example :
|
|
|
|
# {
|
|
|
|
# 'keystone-context_is_admin' => {
|
|
|
|
# 'key' => 'context_is_admin',
|
|
|
|
# 'value' => 'true'
|
|
|
|
# },
|
|
|
|
# 'keystone-default' => {
|
|
|
|
# 'key' => 'default',
|
|
|
|
# 'value' => 'rule:admin_or_owner'
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
# Defaults to empty hash.
|
|
|
|
#
|
|
|
|
# [*policy_path*]
|
2021-03-16 12:36:58 +09:00
|
|
|
# (Optional) Path to the keystone policy.yaml file
|
2020-12-29 16:12:13 +09:00
|
|
|
# Defaults to /etc/keystone/policy.yaml
|
2015-01-12 13:54:54 -07:00
|
|
|
#
|
2023-01-23 14:25:55 +09:00
|
|
|
# [*policy_default_rule*]
|
|
|
|
# (Optional) Default rule. Enforced when a requested rule is not found.
|
2023-03-02 11:10:02 +09:00
|
|
|
# Defaults to $facts['os_service_default'].
|
2023-01-23 14:25:55 +09:00
|
|
|
#
|
2021-03-23 09:24:03 +01:00
|
|
|
# [*policy_dirs*]
|
|
|
|
# (Optional) Path to the keystone policy folder
|
2023-03-02 11:10:02 +09:00
|
|
|
# Defaults to $facts['os_service_default']
|
2021-03-23 09:24:03 +01:00
|
|
|
#
|
2021-09-04 22:10:32 +09:00
|
|
|
# [*purge_config*]
|
|
|
|
# (optional) Whether to set only the specified policy rules in the policy
|
|
|
|
# file.
|
|
|
|
# Defaults to false.
|
|
|
|
#
|
2015-01-12 13:54:54 -07:00
|
|
|
class keystone::policy (
|
2023-03-02 11:10:02 +09:00
|
|
|
$enforce_scope = $facts['os_service_default'],
|
|
|
|
$enforce_new_defaults = $facts['os_service_default'],
|
2023-06-20 14:14:58 +09:00
|
|
|
Hash $policies = {},
|
2021-03-18 20:57:27 +09:00
|
|
|
$policy_path = '/etc/keystone/policy.yaml',
|
2023-03-02 11:10:02 +09:00
|
|
|
$policy_default_rule = $facts['os_service_default'],
|
|
|
|
$policy_dirs = $facts['os_service_default'],
|
2023-07-22 23:46:47 +09:00
|
|
|
Boolean $purge_config = false,
|
2015-01-12 13:54:54 -07:00
|
|
|
) {
|
|
|
|
|
2019-12-08 23:09:22 +01:00
|
|
|
include keystone::deps
|
|
|
|
include keystone::params
|
2016-02-23 18:31:15 -07:00
|
|
|
|
2021-09-04 22:10:32 +09:00
|
|
|
$policy_parameters = {
|
|
|
|
policies => $policies,
|
|
|
|
policy_path => $policy_path,
|
|
|
|
file_user => 'root',
|
|
|
|
file_group => $::keystone::params::group,
|
|
|
|
file_format => 'yaml',
|
|
|
|
purge_config => $purge_config,
|
2015-01-12 13:54:54 -07:00
|
|
|
}
|
|
|
|
|
2021-09-04 22:10:32 +09:00
|
|
|
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
2018-01-10 14:09:29 -08:00
|
|
|
|
2024-03-01 02:35:11 +09:00
|
|
|
# policy config should occur in the config block also.
|
|
|
|
Anchor['keystone::config::begin']
|
|
|
|
-> Openstacklib::Policy[$policy_path]
|
|
|
|
-> Anchor['keystone::config::end']
|
|
|
|
|
2020-10-21 21:06:07 +09:00
|
|
|
oslo::policy { 'keystone_config':
|
2021-03-18 20:57:27 +09:00
|
|
|
enforce_scope => $enforce_scope,
|
|
|
|
enforce_new_defaults => $enforce_new_defaults,
|
2021-03-23 09:24:03 +01:00
|
|
|
policy_file => $policy_path,
|
2023-01-23 14:25:55 +09:00
|
|
|
policy_default_rule => $policy_default_rule,
|
2021-03-23 09:24:03 +01:00
|
|
|
policy_dirs => $policy_dirs,
|
2020-10-21 21:06:07 +09:00
|
|
|
}
|
2018-01-10 14:09:29 -08:00
|
|
|
|
2015-01-12 13:54:54 -07:00
|
|
|
}
|