Skip to content

Commit

Permalink
inirial server instance define
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHoenscheid committed Jun 28, 2023
1 parent ed0fbf8 commit c8e64a1
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions manifests/server_instance.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# lint:ignore:140chars
# @param instace_name
# @param initdb_settings
# @param config_settings
# @param service_settings
# @param passwd_settings
# @param roles Specifies a hash from which to generate postgresql::server::role resources.
# @param config_entries Specifies a hash from which to generate postgresql::server::config_entry resources.
# @param pg_hba_rules Specifies a hash from which to generate postgresql::server::pg_hba_rule resources.

# lint:endignore:140chars
define postgresql::server_instance (
String $instace_name = $name,
Hash $initdb_settings = {},
Hash $config_settings = {},
Hash $service_settings = {},
Hash $passwd_settings = {},
Hash $roles = {},
Hash $config_entries = {},
Hash $pg_hba_rules = {},
) {
postgresql::server::instance::initdb { $instace_name:
* => $initdb_settings,
}
postgresql::server::instance::config { $instace_name:
* => $config_settings,
}
postgresql::server::instance::service { $instace_name:
* => $service_settings,
}
postgresql::server::instance::passwd { $instace_name:
* => $passwd_settings,
}

$roles.each |$rolename, $role| {
postgresql::server::role { $rolename:
* => $role,
}
}

$config_entries.each |$entry, $value| {
postgresql::server::config_entry { $entry:
ensure => bool2str($value =~ Undef, 'absent', 'present'),
value => $value,
}
}

$pg_hba_rules.each |String[1] $rule_name, Postgresql::Pg_hba_rule $rule| {
postgresql::server::pg_hba_rule { $rule_name:
* => $rule,
}
}
}

0 comments on commit c8e64a1

Please sign in to comment.