
Previously, users would receive an error similar to the one below after sourcing keystone authentication variables (i.e. source openrc) and running the puppet agent: debug: Puppet::Type::Keystone_user::ProviderKeystone: Executing '/usr/bin/keystone --os-auth-url http://127.0.0.1:35357/v2.0/ token-get' err: /Stage[main]/Nova::Keystone::Auth/Keystone_user[nova]: Could not evaluate: Execution of '/usr/bin/keystone --os-auth-url http://127.0.0.1:35357/v2.0/ token-get' returned 1: Configuration error: Client configured to run without a service catalog. Run the client using --os-auth-url or OS_AUTH_URL, instead of --os-endpoint or OS_SERVICE_ENDPOINT, for example. WARNING: Bypassing authentication using a token & endpoint (authentication credentials are being ignored). Even though the OS_AUTH_URL was being provided in the auth file, Keystone will ignore it and other variables related to user/pswd based authnetication. This is because only one form of auth (token or user/password) can be used at a time and Keystone will prefer token-based auth if both are provided. This change introduces the new parameter use_token_auth to set the Keystone auth file based on user/password or token-based authentication. Defaults to false for backwards compatibility and to use user/password authentication. Additional Information: http://docs.openstack.org/developer/keystone/configuration.html https://lists.launchpad.net/openstack/msg22356.html Additionally, Region support was added through the region_name parameter. Defaults to RegionOne for backwards compatibility and to use the default region named RegionOne. Change-Id: I913d8da5b753c8db40a05ba2ae1784750f722a5b
39 lines
1016 B
Puppet
39 lines
1016 B
Puppet
#
|
|
# Creates an auth file that can be used to export
|
|
# environment variables that can be used to authenticate
|
|
# against a keystone server.
|
|
#
|
|
class openstack::auth_file(
|
|
$controller_node = '127.0.0.1',
|
|
$keystone_admin_token = undef,
|
|
$admin_user = 'admin',
|
|
$admin_password = undef,
|
|
$admin_tenant = 'admin',
|
|
$region_name = 'RegionOne',
|
|
$use_no_cache = true
|
|
) {
|
|
|
|
if ($keystone_admin_token) {
|
|
file { '/root/openrc':
|
|
content =>
|
|
"
|
|
export OS_SERVICE_TOKEN=${keystone_admin_token}
|
|
export OS_SERVICE_ENDPOINT=http://${controller_node}:35357/v2.0/
|
|
"
|
|
}
|
|
} else {
|
|
file { '/root/openrc':
|
|
content =>
|
|
"
|
|
export OS_NO_CACHE=${use_no_cache}
|
|
export OS_TENANT_NAME=${admin_tenant}
|
|
export OS_USERNAME=${admin_user}
|
|
export OS_PASSWORD='${admin_password}'
|
|
export OS_AUTH_URL=\"http://${controller_node}:5000/v2.0/\"
|
|
export OS_AUTH_STRATEGY=keystone
|
|
export OS_REGION_NAME=${region_name}
|
|
"
|
|
}
|
|
}
|
|
}
|