Puppet Class: pg_profile::database

Inherited by:
pg_profile::database::cis_controls
Defined in:
manifests/database.pp

Summary

A short summary of the purpose of this defined type.

Overview

pg_profile::database

A description of what this defined type does

--

pg_profile::database

This is a highly customizable Puppet profile class to define an Postgres database on your system. In it’s core just adding:

“‘ contain ::pg_profile::database “`

Is enough to get an Postgres database running on your system.

But sometimes you have specific uses cases that are not handled well by the standard classes. This profile class allows you to add your own code to the execution.

## Stages

Defining and starting an Postgres database on you system goes through several steps:

  • em_license ( Manage Enterprise Modules Licenses)

  • sysctl ( Setup any sysctl parameters)

  • limits ( Setup any security limits)

  • groups_and_users ( Setup required groups and users)

  • packages ( Setup any required after_packages)

  • firewall ( Setup the firewall)

  • db_software ( Install the postgres software)

  • db_init ( Take care of initial database stup)

  • db_startup ( Manage starting the database)

  • db_roles ( Ensure required Postgres database roles)

  • db_definition ( Ensure required Postgress databases)

  • db_parameters ( Ensure required Postgres database settings)

  • db_tablespaces ( Ensure needed tablespaces)

  • db_schemas ( Ensure needed database schema’s)

  • db_records ( Ensure required database records (for settings))

All these steps have a default implementation. This implementation is suitable to get started with. These classed all have parameters you can customize through hiera values. The defaults are specified in the module’s ‘data/default.yaml` file.

## before classes

But sometimes this is not enough and you would like to add some extra definitions, you can, for example, add a Puppet class to be executed after the ‘systctl` stage is done and before the `limits` is done. You can do this by adding the next line to your yaml data:

“‘yaml pg_profile::database::before_sysctl: my_profile::my_extra_class “`

## after classes

You can do the same when you want to add code after one of the stage classes:

“‘yaml pg_profile::database::after_sysctl: my_profile::my_extra_class “`

## Skipping

Sometimes organisation use different modules and mechanisms to implement a feature and you want to skip the class:

“‘yaml pg_profile::database::sysctl: skip “`

## Replacing

Or provide your own implementation:

“‘yaml pg_profile::database::sysctl: my_profile::my_own_implementation “`

This mechanism can be used for all named stages and makes it easy to move from an easy setup with a running standard database to a fully customized setup using a lot of your own classes plugged in.

Look at the description of the stages and their properties.

At this level you can also customize some generic settings. Check the settings for:

  • ‘version`

Here is an example on how you can do this:

“‘puppet

class

version => '13',

“‘

<!–

-->

–++–

Examples:

pg_profile::database { 'database_name': }

Parameters:

  • before_em_license (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘em_license` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_em_license: my_module::my_class “`

  • before_sysctl (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘sysctl` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_sysctl: my_module::my_class “`

  • before_limits (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘limits` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_limits: my_module::my_class “`

  • before_groups_and_users (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘groups_and_users` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_groups_and_users: my_module::my_class “`

  • before_packages (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘packages` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_packages: my_module::my_class “`

  • before_firewall (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘firewall` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_firewall: my_module::my_class “`

  • before_db_software (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_software` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_software: my_module::my_class “`

  • before_db_init (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_init` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_init: my_module::my_class “`

  • before_db_startup (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_startup` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_startup: my_module::my_class “`

  • before_db_roles (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_users` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_users: my_module::my_class “`

  • before_db_definition (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_definition` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_definition: my_module::my_class “`

  • before_db_parameters (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_parameters` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_parameters: my_module::my_class “`

  • before_db_tablespaces (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_tablespaces` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_tablespaces: my_module::my_class “`

  • before_db_schemas (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_schemas` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_schemas: my_module::my_class “`

  • before_db_records (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly before the ‘db_records` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::before_db_records: my_module::my_class “`

  • em_license (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘em_license`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::em_license: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::em_license: skip “`

  • sysctl (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘sysctl`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_definition: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_definition: skip “`

  • limits (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘limits`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::limits: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::limits: skip “`

  • groups_and_users (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘groups_and_users`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::groups_and_users: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::groups_and_users: skip “`

  • packages (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘packages`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::packages: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::packages: skip “`

  • firewall (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘firewall`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::firewall: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::firewall: skip “`

  • db_software (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_software`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_software: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_software: skip “`

  • db_init (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_init`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_init: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_init: skip “`

  • db_startup (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_startup`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_startup: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_startup: skip “`

  • db_roles (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_roles`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_roles: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_roles: skip “`

  • db_definition (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_definition`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_definition: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_definition: skip “`

  • db_parameters (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_parameters`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_parameters: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_parameters: skip “`

  • db_tablespaces (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_tablespaces`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_tablespaces: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_tablespaces: skip “`

  • db_schemas (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_schemas`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_schemas: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_schemas: skip “`

  • db_records (Optional[String]) (defaults to: undef)

    Use this value if you want to skip or use your own class for step ‘db_records`. ## Use your own class You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_records: my_module::my_class “` ## Skip You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::db_records: skip “`

  • after_em_license (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘em_license` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_em_license: my_module::my_class “`

  • after_sysctl (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘sysctl` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_sysctl: my_module::my_class “`

  • after_limits (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘limits` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_limits: my_module::my_class “`

  • after_groups_and_users (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘groups_and_users` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_groups_and_users: my_module::my_class “`

  • after_packages (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘packages` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_packages: my_module::my_class “`

  • after_firewall (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘firewall` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_firewall: my_module::my_class “`

  • after_db_software (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_software` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_software: my_module::my_class “`

  • after_db_init (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_init` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_init: my_module::my_class “`

  • after_db_startup (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_startup` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_startup: my_module::my_class “`

  • after_db_roles (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_users` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_users: my_module::my_class “`

  • after_db_definition (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_definition` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_definition: my_module::my_class “`

  • after_db_parameters (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_parameters` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_parameters: my_module::my_class “`

  • after_db_tablespaces (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_tablespaces` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_tablespaces: my_module::my_class “`

  • after_db_schemas (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_schemas` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_schemas: my_module::my_class “`

  • after_db_records (Optional[String]) (defaults to: undef)

    The name of the class you want to execute directly after the ‘db_records` class. You can use hiera to set this value. Here is an example: “`yaml pg_profile::database::after_db_records: my_module::my_class “`



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'manifests/database.pp', line 506

class pg_profile::database(
  Optional[String] $before_em_license       = undef,
  Optional[String] $before_sysctl           = undef,
  Optional[String] $before_limits           = undef,
  Optional[String] $before_groups_and_users = undef,
  Optional[String] $before_packages         = undef,
  Optional[String] $before_firewall         = undef,
  Optional[String] $before_db_software      = undef,
  Optional[String] $before_db_init          = undef,
  Optional[String] $before_db_startup       = undef,
  Optional[String] $before_db_roles         = undef,
  Optional[String] $before_db_definition    = undef,
  Optional[String] $before_db_parameters    = undef,
  Optional[String] $before_db_tablespaces   = undef,
  Optional[String] $before_db_schemas       = undef,
  Optional[String] $before_db_records       = undef,
  Optional[String] $em_license              = undef,
  Optional[String] $sysctl                  = undef,
  Optional[String] $limits                  = undef,
  Optional[String] $groups_and_users        = undef,
  Optional[String] $packages                = undef,
  Optional[String] $firewall                = undef,
  Optional[String] $db_software             = undef,
  Optional[String] $db_init                 = undef,
  Optional[String] $db_startup              = undef,
  Optional[String] $db_roles                = undef,
  Optional[String] $db_definition           = undef,
  Optional[String] $db_parameters           = undef,
  Optional[String] $db_tablespaces          = undef,
  Optional[String] $db_schemas              = undef,
  Optional[String] $db_records              = undef,
  Optional[String] $after_em_license        = undef,
  Optional[String] $after_sysctl            = undef,
  Optional[String] $after_limits            = undef,
  Optional[String] $after_groups_and_users  = undef,
  Optional[String] $after_packages          = undef,
  Optional[String] $after_firewall          = undef,
  Optional[String] $after_db_software       = undef,
  Optional[String] $after_db_init           = undef,
  Optional[String] $after_db_startup        = undef,
  Optional[String] $after_db_roles          = undef,
  Optional[String] $after_db_definition     = undef,
  Optional[String] $after_db_parameters     = undef,
  Optional[String] $after_db_tablespaces    = undef,
  Optional[String] $after_db_schemas        = undef,
  Optional[String] $after_db_records        = undef,
)
{

  easy_type::debug_evaluation() # Show local variable on extended debug

  easy_type::ordered_steps([
    'pg_profile::database::em_license',
    ['pg_profile::database::sysctl',           { 'implementation' => 'easy_type::profile::sysctl' }],
    ['pg_profile::database::limits',           { 'implementation' => 'easy_type::profile::limits' }],
    ['pg_profile::database::groups_and_users', { 'implementation' => 'easy_type::profile::groups_and_users' }],
    ['pg_profile::database::packages',         { 'implementation' => 'easy_type::profile::packages' }],
    ['pg_profile::database::firewall',         { 'implementation' => 'easy_type::profile::firewall' }],
    'pg_profile::database::db_software',
    'pg_profile::database::db_init',
    'pg_profile::database::db_startup',
    'pg_profile::database::db_roles',
    'pg_profile::database::db_definition',
    'pg_profile::database::db_parameters',
    'pg_profile::database::db_tablespaces',
    'pg_profile::database::db_schemas',
    'pg_profile::database::db_records',
  ])
}