Puppet Class: db2_profile::database
- Inherits:
- db2_profile
- Inherited by:
-
db2_profile::database::cis_controls
- Defined in:
- manifests/database.pp
Summary
This is a highly customizable Puppet profile class to define an IBM DB2 database on your system.Overview
db2_profile::database
In it’s core just adding:
“‘ contain db2_profile::database “`
Is enough to get an IBM DB2 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.
## Steps
Defining and starting an DB2 database on you system goes through several steps :
-
‘em_license` (setup Enterprise Modules licenses)
-
‘setup` (Configure DB2 fact caching)
-
‘sysctl` (Set required sysctl settings)
-
‘limits` (Set required security limits)
-
‘groups_and_users` (Ensure required OS groups and users)
-
‘packages` (Ensure require OS packages)
-
‘firewall` (Configure firewall for DB2 usage)
-
‘db_software` (Install the DB2 software)
-
‘db_fixpack` (Install the DB2 fixpack)
-
‘db_instance` (Ensure DB2 instances)
-
‘db_definition` (Ensure DB2 databases)
-
‘db_primary` (Set the database as primary database when using HADR)
-
‘db_standby` (Set the database as standby database when using HADR)
-
‘db_tablespaces` (Ensure DB2 tablespaces)
-
‘db_users` (Ensure DB2 users in database)
-
‘db_roles` (Ensure DB2 roles)
-
‘db_groups` (Ensure DB2 groups in database)
-
‘db_schemas` (Ensure DB2 schemas)
-
‘db_startup` (Esnure DB2 startup after reboot)
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 db2_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 db2_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 db2_profile::database::sysctl: skip “`
## Replacing
Or provide your own implementation:
“‘yaml db2_profile::database::sysctl: my_profile::my_own_implementation “`
This mechanism can be used for all named steps 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 steps and their properties.
See the file “LICENSE” for the full license governing this code.
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
# File 'manifests/database.pp', line 663
class db2_profile::database (
Optional[String] $after_db_definition = undef,
Optional[String] $after_db_fixpack = undef,
Optional[String] $after_db_groups = undef,
Optional[String] $after_db_instance = undef,
Optional[String] $after_db_primary = undef,
Optional[String] $after_db_roles = undef,
Optional[String] $after_db_schemas = undef,
Optional[String] $after_db_software = undef,
Optional[String] $after_db_standby = undef,
Optional[String] $after_db_startup = undef,
Optional[String] $after_db_tablespaces = undef,
Optional[String] $after_db_users = undef,
Optional[String] $after_em_license = undef,
Optional[String] $after_setup = undef,
Optional[String] $after_firewall = undef,
Optional[String] $after_groups_and_users = undef,
Optional[String] $after_limits = undef,
Optional[String] $after_pacemaker_setup = undef,
Optional[String] $after_packages = undef,
Optional[String] $after_passwordless_root = undef,
Optional[String] $after_sysctl = undef,
Optional[String] $before_db_definition = undef,
Optional[String] $before_db_fixpack = undef,
Optional[String] $before_db_groups = undef,
Optional[String] $before_db_instance = undef,
Optional[String] $before_db_primary = undef,
Optional[String] $before_db_roles = undef,
Optional[String] $before_db_schemas = undef,
Optional[String] $before_db_software = undef,
Optional[String] $before_db_standby = undef,
Optional[String] $before_db_startup = undef,
Optional[String] $before_db_tablespaces = undef,
Optional[String] $before_db_users = undef,
Optional[String] $before_em_license = undef,
Optional[String] $before_setup = undef,
Optional[String] $before_firewall = undef,
Optional[String] $before_groups_and_users = undef,
Optional[String] $before_limits = undef,
Optional[String] $before_pacemaker_setup = undef,
Optional[String] $before_packages = undef,
Optional[String] $before_passwordless_root = undef,
Optional[String] $before_sysctl = undef,
Optional[String] $cluster_manager = undef,
Optional[String] $db_definition = undef,
Optional[String] $db_fixpack = undef,
Optional[String] $db_groups = undef,
Optional[String] $db_instance = undef,
Optional[String] $db_primary = undef,
Optional[String] $db_roles = undef,
Optional[String] $db_schemas = undef,
Optional[String] $db_software = undef,
Optional[String] $db_standby = undef,
Optional[String] $db_startup = undef,
Optional[String] $db_tablespaces = undef,
Optional[String] $db_users = undef,
Optional[String] $em_license = undef,
Optional[String] $setup = undef,
Optional[String] $firewall = undef,
Optional[String] $groups_and_users = undef,
Optional[String] $limits = undef,
Optional[String] $pacemaker_setup = undef,
Optional[String] $packages = undef,
Optional[String] $passwordless_root = undef,
Optional[String[1]] $primary = undef,
Optional[String] $sysctl = undef
) inherits db2_profile {
$is_linux = $facts['kernel'] == 'Linux'
$is_windows = $facts['kernel'] == 'Windows'
$is_hadr = $primary != undef
$is_primary = $primary == $facts['networking']['fqdn'] and $is_hadr
$is_standby = !$is_primary
$configure_cluster_manager = $cluster_manager == 'pacemaker' and $is_hadr
easy_type::debug_evaluation() # Show local variable on extended debug
easy_type::ordered_steps([
'db2_profile::database::em_license',
'db2_profile::database::setup',
['db2_profile::database::sysctl', { 'onlyif' => $is_linux, 'implementation' => 'easy_type::profile::sysctl' }],
['db2_profile::database::limits', { 'onlyif' => $is_linux, 'implementation' => 'easy_type::profile::limits' }],
['db2_profile::database::groups_and_users', { 'onlyif' => $is_linux, 'implementation' => 'easy_type::profile::groups_and_users' }],
['db2_profile::database::packages', { 'onlyif' => $is_linux, 'implementation' => 'easy_type::profile::packages' }],
['db2_profile::database::firewall', { 'onlyif' => $is_linux, 'implementation' => 'easy_type::profile::firewall' }],
'db2_profile::database::db_software',
'db2_profile::database::db_fixpack',
'db2_profile::database::db_instance',
['db2_profile::database::db_definition', { 'onlyif' => $is_primary or !$is_hadr }],
['db2_profile::database::db_primary', { 'onlyif' => $is_primary and $is_hadr }],
['db2_profile::database::db_standby', { 'onlyif' => !$is_primary and $is_hadr }],
['db2_profile::database::passwordless_root', { 'onlyif' => $configure_cluster_manager }],
['db2_profile::database::pacemaker_setup', { 'onlyif' => $configure_cluster_manager and $is_standby }],
'db2_profile::database::db_tablespaces',
'db2_profile::database::db_users',
'db2_profile::database::db_roles',
'db2_profile::database::db_groups',
'db2_profile::database::db_schemas',
'db2_profile::database::db_startup'
])
}
|