-
Notifications
You must be signed in to change notification settings - Fork 614
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed0fbf8
commit c8e64a1
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
} | ||
} |