Skip to content

Commit 8b6bb15

Browse files
initial server instance define
1 parent ed0fbf8 commit 8b6bb15

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

manifests/server_instance.pp

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# lint:ignore:140chars
2+
# @param instace_name
3+
# @param initdb_settings
4+
# @param config_settings
5+
# @param service_settings
6+
# @param passwd_settings
7+
# @param roles Specifies a hash from which to generate postgresql::server::role resources.
8+
# @param config_entries Specifies a hash from which to generate postgresql::server::config_entry resources.
9+
# @param pg_hba_rules Specifies a hash from which to generate postgresql::server::pg_hba_rule resources.
10+
11+
# lint:endignore:140chars
12+
define postgresql::server_instance (
13+
String $instace_name = $name,
14+
Hash $initdb_settings = {},
15+
Hash $config_settings = {},
16+
Hash $service_settings = {},
17+
Hash $passwd_settings = {},
18+
Hash $roles = {},
19+
Hash $config_entries = {},
20+
Hash $pg_hba_rules = {},
21+
) {
22+
postgresql::server::instance::initdb { $instace_name:
23+
* => $initdb_settings,
24+
}
25+
postgresql::server::instance::config { $instace_name:
26+
* => $config_settings,
27+
}
28+
postgresql::server::instance::service { $instace_name:
29+
* => $service_settings,
30+
}
31+
postgresql::server::instance::passwd { $instace_name:
32+
* => $passwd_settings,
33+
}
34+
35+
$roles.each |$rolename, $role| {
36+
postgresql::server::role { $rolename:
37+
* => $role,
38+
}
39+
}
40+
41+
$config_entries.each |$entry, $value| {
42+
postgresql::server::config_entry { $entry:
43+
ensure => bool2str($value =~ Undef, 'absent', 'present'),
44+
value => $value,
45+
}
46+
}
47+
48+
$pg_hba_rules.each |String[1] $rule_name, Postgresql::Pg_hba_rule $rule| {
49+
postgresql::server::pg_hba_rule { $rule_name:
50+
* => $rule,
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)