Module for Common Puppet OpenStack Dependencies
Go to file
2024-10-03 15:41:19 +00:00
doc Update openstackdocstheme to the latest version 2021-09-29 16:06:50 +08:00
examples Replace legacy facts and use fact hash 2023-03-01 16:50:04 +09:00
facts.d Making immutable config setting when using <_IMMUTABLE_>. 2018-06-29 22:13:55 +02:00
lib Extend command timeout 2024-10-02 00:41:07 +09:00
manifests Validate input for file mode 2024-09-30 12:29:05 +09:00
releasenotes Merge "Remove support for json format policy files" 2024-06-11 16:24:44 +00:00
spec Extend command timeout 2024-10-02 00:41:07 +09:00
templates policy-rc.d: Define default behavior(return code) 2022-06-26 14:34:34 +09:00
types Add type to validate policy hash input 2024-09-30 10:59:09 +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:49:38 +00:00
.pdkignore Exclude release note files 2023-08-11 17:57:44 +09:00
.zuul.yaml Remove TripleO job 2023-03-13 11:19:38 +09:00
bindep.txt modulesync: sync and add nodepool-bionic for beaker 2018-07-18 16:19:17 +02:00
CHANGELOG.md Release 8.0.0 2016-03-23 16:07:47 -04:00
Gemfile Use openstack_spec_helper from zuul checkout 2020-08-30 23:01:54 +02:00
LICENSE Update LICENSE 2018-04-06 20:14:54 +08:00
metadata.json Prepare 2024.2 release 2024-10-02 10:22:58 +09:00
Rakefile Use puppet-openstack_spec_helper for Rakefile & spec_helper_acceptance 2016-01-18 09:11:30 -05:00
README.md Fix old github url 2023-12-25 16:54:20 +09:00
setup.cfg Add information technology in the setup.cfg 2021-10-01 06:54:49 +08:00
setup.py setuptools: Disable auto discovery 2022-03-29 10:40:57 +02:00
tox.ini Stop configuring install_command in tox. 2021-09-29 18:15:06 +09:00

Team and repository tags

Team and repository tags

openstacklib

Table of Contents

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

Overview

The openstacklib 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 not part of the core software. The module itself is used to expose common functionality between Openstack modules as a library that can be utilized to avoid code duplication.

Module Description

The openstacklib module is a library module for other Openstack modules to utilize. A thorough description will be added later.

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

Setup

Installing openstacklib

puppet module install openstack/openstacklib

Usage

Classes and Defined Types

Defined type: openstacklib::db::mysql

The db::mysql resource is a library resource that can be used by nova, cinder, ceilometer, etc., to create a mysql database with configurable privileges for a user connecting from defined hosts.

Typically this resource will be declared with a notify parameter to configure the sync command to execute when the database resource is changed.

For example, in heat::db::mysql you might declare:

::openstacklib::db::mysql { 'heat':
    password_hash => mysql::password($password),
    dbname        => $dbname,
    user          => $user,
    host          => $host,
    charset       => $charset,
    collate       => $collate,
    allowed_hosts => $allowed_hosts,
    notify        => Exec['heat-dbsync'],
  }

Some modules should ensure that the database is created before the service is set up. For example, in keystone::db::mysql you would have:

::openstacklib::db::mysql { 'keystone':
    password_hash => mysql::password($password),
    dbname        => $dbname,
    user          => $user,
    host          => $host,
    charset       => $charset,
    collate       => $collate,
    allowed_hosts => $allowed_hosts,
    notify        => Exec['keystone-manage db_sync'],
    before        => Service['keystone'],
  }

** Parameters for openstacklib::db::mysql: **

#####password_hash Password hash to use for the database user for this service; string; required

#####dbname The name of the database string; optional; default to the $title of the resource, i.e. 'nova'

#####user The database user to create; string; optional; default to the $title of the resource, i.e. 'nova'

#####host The IP address or hostname of the user in mysql_grant; string; optional; default to '127.0.0.1'

#####charset The charset to use for the database; string; optional; default to 'utf8'

#####collate The collate to use for the database; string; optional; default to 'utf8_general_ci'

#####allowed_hosts Additional hosts that are allowed to access this database; array or string; optional; default to undef

#####privileges Privileges given to the database user; string or array of strings; optional; default to 'ALL'

Defined type: openstacklib::db::postgresql

The db::postgresql resource is a library resource that can be used by nova, cinder, ceilometer, etc., to create a postgresql database and a user with configurable privileges.

Typically this resource will be declared with a notify parameter to configure the sync command to execute when the database resource is changed.

For example, in heat::db::postgresql you might declare:

::openstacklib::db::postgresql { $dbname:
  password_hash => postgresql_password($user, $password),
  dbname        => $dbname,
  user          => $user,
  notify        => Exec['heat-dbsync'],
}

Some modules should ensure that the database is created before the service is set up. For example, in keystone::db::postgresql you would have:

::openstacklib::db::postgresql { $dbname:
  password_hash => postgresql_password($user, $password),
  dbname        => $dbname,
  user          => $user,
  notify        => Exec['keystone-manage db_sync'],
  before        => Service['keystone'],
}

** Parameters for openstacklib::db::postgresql: **

#####password_hash Password hash to use for the database user for this service; string; required

#####dbname The name of the database string; optional; default to the $title of the resource, i.e. 'nova'

#####user The database user to create; string; optional; default to the $title of the resource, i.e. 'nova'

#####encoding The encoding use for the database; string; optional; default to undef

#####privileges Privileges given to the database user; string or array of strings; optional; default to 'ALL'

Defined type: openstacklib::service_validation

The service_validation resource is a library resource that can be used by nova, cinder, ceilometer, etc., to validate that a resource is actually up and running.

For example, in nova::api you might declare:

::openstacklib::service_validation { 'nova-api':
    command => 'nova list',
  }

This defined resource creates an exec-anchor pair where the anchor depends upon the successful exec run.

** Parameters for openstacklib::service_validation: **

#####command Command to run for validating the service; string; required

#####service_name The name of the service to validate; string; optional; default to the $title of the resource, i.e. 'nova-api'

#####path The path of the command to validate the service; string; optional; default to '/usr/bin:/bin:/usr/sbin:/sbin'

#####provider The provider to use for the exec command; string; optional; default to 'shell'

#####tries Number of times to retry validation; string; optional; default to '10'

#####try_sleep Number of seconds between validation attempts; string; optional; default to '2'

Defined provider for openstack_config: ini_setting

It provides an interface to any INI configuration file as they are used in Openstack modules.

You use it like this:

Puppet::Type.type(:<module>_config).provide(
  :openstackconfig,
  :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do

It has the standard features of the upstream puppetlabs' inifile module as it's a direct children of it. Furthermore it can transform a value with some function of you're choice, enabling you to get value that get filled at run-time like an uuid.

For an example of how that's working you can have a look at this review

Defined provider for openstack_config: ruby

This one has the same basic features as the ini_setting one but the ability to transformation the value. It offers another feature, though. It can parse array. What it enables one to do is to parse this correctly:

[DEFAULT]
conf1 = value1
conf1 = value2

On the opposite side if you put that:

module_config { 'DEFAULT/conf1' : value => ['value1', 'value2'] }

in your manifest, it will properly be written as the example above.

To use this provider you use this:

Puppet::Type.type(:<module>_config).provide(
  :openstackconfig,
  :parent => Puppet::Type.type(:openstack_config).provider(:ruby)
) do

and define you type with :array_matching => :all. An example of such provider is nova_config. Have a look for inspiration.

Implementation

openstacklib

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

Limitations

The python-migrate system package for RHEL 6 and below is out of date and may fail to correctly migrate postgresql databases. While this module does not handle database migrations, it is common to set up refresh relationships between openstacklib::db::postgresql resource and the database sync exec resource. Relying on this behavior may cause errors.

Development

Developer documentation for the entire puppet-openstack project.

Contributors

Release Notes

Repository