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',
“‘
<!–
-->
–++–
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',
])
}
|