OpenStack Keystone Puppet Module
Go to file
Takashi Kajinami 82b7d7ea58 Use yaml instead of json for policy file
Because usage of json for policy file will be deprecated and replaced
by yaml[1].

[1] https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Depends-on: https://review.opendev.org/769647
Change-Id: I8d759345f33cf4e8e47688f1c1dc567da6b8fe4b
2021-01-07 23:10:20 +00:00
doc Switch to newer openstackdocstheme and reno versions 2020-06-02 14:40:41 +02:00
examples Remove deprecated bind, port and workers parameters 2020-08-18 09:35:02 +02:00
lib Always pass --name when flushing keystone_service 2020-07-13 19:19:06 +00:00
manifests Use yaml instead of json for policy file 2021-01-07 23:10:20 +00:00
releasenotes Use yaml instead of json for policy file 2021-01-07 23:10:20 +00:00
spec Use yaml instead of json for policy file 2021-01-07 23:10:20 +00:00
templates Unset memcached_servers by default 2020-10-29 23:56:15 +09:00
.gitignore Dissuade .gitignore references to personal tools 2018-10-08 11:39:24 +08:00
.gitreview OpenDev Migration Patch 2019-04-19 19:32:21 +00:00
.sync.yml Initial msync run for all Puppet OpenStack modules 2015-08-06 20:47:48 +02:00
.zuul.yaml Build containers for single consumer job 2020-11-06 14:31:52 +00:00
bindep.txt modulesync: sync and add nodepool-bionic for beaker 2018-07-18 16:18:30 +02:00
CHANGELOG.md Release 8.0.0 2016-03-23 17:08:06 -04:00
CONTRIBUTING.rst [ussuri][goal] Add CONTRIBUTING.rst 2020-05-10 22:40:06 +02:00
Gemfile Use openstack_spec_helper from zuul checkout 2020-08-30 22:58:09 +02:00
LICENSE Update LICENSE 2018-04-06 20:14:33 +08:00
metadata.json Prepare Wallaby M1 2020-12-04 13:31:37 +08:00
Rakefile Use puppet-openstack_spec_helper for Rakefile & spec_helper_acceptance 2016-01-27 17:38:14 +00:00
README.md Deprecate database options from the keystone class 2020-10-20 11:58:52 +09:00
setup.cfg Change openstack-dev to openstack-discuss 2018-12-02 18:20:01 +01:00
setup.py Add basic structure for ReNo 2016-01-26 14:30:35 -05:00
tox.ini Replace deprecated UPPER_CONSTRAINTS_FILE variable 2020-11-11 09:08:35 +08:00

Team and repository tags

Team and repository tags

keystone

Table of Contents

  1. Overview - What is the keystone module?
  2. Module Description - What does the module do?
  3. Setup - The basics of getting started with keystone
  4. Implementation - An under-the-hood peek at what the module is doing
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module
  7. Contributors - Those with commits
  8. Release Notes - Release notes for the project
  9. Repository - The project source code repository

Overview

The keystone module is a part of OpenStack, an effort by the OpenStack infrastructure team to provide continuous integration testing and code review for OpenStack and OpenStack community projects as part of the core software. The module itself is used to flexibly configure and manage the identity service for OpenStack.

Module Description

The keystone module is a thorough attempt to make Puppet capable of managing the entirety of keystone. This includes manifests to provision region specific endpoint and database connections. Types are shipped as part of the keystone module to assist in manipulation of configuration files.

This module is tested in combination with other modules needed to build and leverage an entire OpenStack software stack.

Setup

What the keystone module affects

  • Keystone, the identity service for OpenStack.

Installing keystone

puppet module install openstack/keystone

Beginning with keystone

To utilize the keystone module's functionality you will need to declare multiple resources. This is not an exhaustive list of all the components needed, we recommend you consult and understand the core openstack documentation.

Define a keystone node

class { 'keystone::db':
  database_connection => 'mysql://keystone_admin:super_secret_db_password@openstack-controller.example.com/keystone',
}

class { 'keystone':
  catalog_type => 'sql',
}

class { 'keystone::bootstrap':
  password     => 'super_secret',
  public_url   => 'http://10.16.0.101:5000',
  admin_url    => 'http://10.16.1.101:5000',
  internal_url => 'http://10.16.2.101:5000',
  region       => 'example-1',
}

Leveraging the Native Types

Keystone ships with a collection of native types that can be used to interact with the data stored in keystone. The following, related to user management could live throughout your Puppet code base. They even support puppet's ability to introspect the current environment much the same as puppet resource user, puppet resource keystone_tenant will print out all the currently stored tenants and their parameters.

keystone_tenant { 'openstack':
  ensure  => present,
  enabled => true,
}
keystone_user { 'openstack':
  ensure  => present,
  enabled => true,
}
keystone_role { 'admin':
  ensure => present,
}
keystone_user_role { 'admin@openstack':
  roles => ['admin', 'superawesomedude'],
  ensure => present
}

These two will seldom be used outside openstack related classes, like nova or cinder. These are modified examples from Class['nova::keystone::auth'].

# Setup the nova keystone service
keystone_service { 'nova':
  ensure      => present,
  type        => 'compute',
  description => 'OpenStack Compute Service',
}

Services can also be written with the type as a suffix:

keystone_service { 'nova::type':
  ensure      => present,
  description => 'OpenStack Compute Service',
}


# Setup nova keystone endpoint
keystone_endpoint { 'example-1-west/nova':
   ensure       => present,
   type         => 'compute',
   public_url   => "http://127.0.0.1:8774/v2/%(tenant_id)s",
   admin_url    => "http://127.0.0.1:8774/v2/%(tenant_id)s",
   internal_url => "http://127.0.0.1:8774/v2/%(tenant_id)s",
}

Endpoints can also be written with the type as a suffix:

keystone_endpoint { 'example-1-west/nova::compute':
   ensure       => present,
   public_url   => "http://127.0.0.1:8774/v2/%(tenant_id)s",
   admin_url    => "http://127.0.0.1:8774/v2/%(tenant_id)s",
   internal_url => "http://127.0.0.1:8774/v2/%(tenant_id)s",
}

Defining an endpoint without the type is supported in Liberty release for backward compatibility, but will be dropped in Mitaka, as this can lead to corruption of the endpoint database if omitted. See this bug

Setting up a database for keystone

A keystone database can be configured separately from the keystone services.

If one needs to actually install a fresh database they have the choice of mysql or postgres. Use the mysql::server or postgreql::server classes to do this setup, and then the Class['keystone::db::mysql'] or Class['keystone::db::postgresql'] for adding the databases and users that will be needed by keystone.

  • For mysql
class { 'mysql::server': }

class { 'keystone::db::mysql':
  password      => 'super_secret_db_password',
  allowed_hosts => '%',
}
  • For postgresql
class { 'postgresql::server': }

class { 'keystone::db::postgresql': password => 'super_secret_db_password', }

About Keystone V3 syntax in keystone_user/keystone_tenant/keystone_user_role

A complete description of the syntax available for those resources are in examples/user_project_user_role_composite_namevar.pp

About Keystone V3 and default domain

For users

With Keystone V3, domains made their appearance. For backward compatibility a default domain is defined in the keystone.conf file. All the V2 resources are then assigned to this default domain. The default domain id is by default default associated with the name Default.

What it means is that this user:

keystone_user { 'my_non_full_qualified_user':
  ensure => present
}

will be assigned to the Default domain.

The same is true for keystone_tenant and keystone_user_role:

keystone_tenant { 'project_one':
  ensure => present
}

keystone_user_role { 'user_one@project_one':
  ensure => present,
  roles  => ['admin']
}

will be assigned to the Default domain.

Now, you can change the default domain if you want. But then the puppet resource you defined will have to be fully qualified.

So, for instance, if you change the default domain to be my_new_default, then you'll have to do:

keystone_user { 'full_qualified_user::my_new_default':
  ensure => present
}
keystone_tenant { 'project_one::my_new_default':
  ensure => present
}

keystone_user_role { 'user_one::my_new_default@project_one::my_new_default':
  ensure => present,
  roles  => ['admin']
}

as the module will always assign a resource without domain to the Default domain.

A deprecation warning will be visible in the log when you have changed the default domain id and used an non fully qualified name for your resource.

In Mitaka, a deprecation warning will be displayed any time you use a non fully qualified resource.

After Mitaka all the resources will have to be fully qualified.

For developers

Other modules can try to find user/tenant resources using Puppet's indirection. The rule for the name of the resources are:

  1. fully qualified if domain is not 'Default';
  2. short form if domain is 'Default'

This is for backward compatibility.

Note that, as stated above, the 'Default' domain is hardcoded. It is not related to the real default domain which can be set to something else. But then again, you will have to set the fully qualified name.

You can check spec/acceptance/default_domain_spec.rb to see an example of the behavior described here.

Implementation

keystone

keystone is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.

Types

keystone_config

The keystone_config provider is a children of the ini_setting provider. It allows one to write an entry in the /etc/keystone/keystone.conf file.

keystone_config { 'token/expiration' :
  value => 3600,
}

This will write expiration=3600 in the [token] section.

name

Section/setting name to manage from keystone.conf

value

The value of the setting to be defined.

secret

Whether to hide the value from Puppet logs. Defaults to false.

ensure_absent_val

If value is equal to ensure_absent_val then the resource will behave as if ensure => absent was specified. Defaults to <SERVICE DEFAULT>

Limitations

  • All the keystone types use the CLI tools and so need to be run on the keystone node.

Upgrade warning

  • If you've setup OpenStack using previous versions of this module you need to be aware that it used UUID as the default for the token_format parameter but now defaults to PKI. If you're using this module to manage a Grizzly OpenStack deployment that was set up using a development release of the modules or are attempting an upgrade from Folsom then you'll need to make sure you set the token_format to UUID at classification time.

Development

Developer documentation for the entire puppet-openstack project.

Contributors

Release Notes

Repository