Skip to content

Commit 602588f

Browse files
committed
add parameter with_admin_option
2 parents d4b252b + 2d652f7 commit 602588f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

manifests/server/grant_role.pp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@
88
# @param port Port to use when connecting.
99
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
1010
# @param instance The name of the Postgresql database instance.
11+
# @param with_admin_option Specifies if the role should be granted with admin option.
1112
define postgresql::server::grant_role (
1213
String[1] $group,
13-
String[1] $role = $name,
14-
Enum['present', 'absent'] $ensure = 'present',
15-
String[1] $instance = 'main',
16-
String[1] $psql_db = $postgresql::server::default_database,
17-
String[1] $psql_user = $postgresql::server::user,
18-
Stdlib::Port $port = $postgresql::server::port,
19-
Hash $connect_settings = $postgresql::server::default_connect_settings,
14+
String[1] $role = $name,
15+
Enum['present', 'absent'] $ensure = 'present',
16+
String[1] $instance = 'main',
17+
String[1] $psql_db = $postgresql::server::default_database,
18+
String[1] $psql_user = $postgresql::server::user,
19+
Stdlib::Port $port = $postgresql::server::port,
20+
Hash $connect_settings = $postgresql::server::default_connect_settings,
21+
Boolean $with_admin_option = false,
2022
) {
2123
case $ensure {
2224
'present': {
23-
$command = "GRANT \"${group}\" TO \"${role}\""
25+
$with_admin_option_sql = $with_admin_option ? { true => 'WITH ADMIN OPTION', default => '' }
26+
$command = "GRANT \"${group}\" TO \"${role}\" ${with_admin_option_sql}"
2427
$unless_comp = '='
2528
}
2629
'absent': {

0 commit comments

Comments
 (0)