|
8 | 8 | # @param port Port to use when connecting.
|
9 | 9 | # @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
|
10 | 10 | # @param instance The name of the Postgresql database instance.
|
| 11 | +# @param with_admin_option Specifies if the role should be granted with admin option. |
11 | 12 | define postgresql::server::grant_role (
|
12 | 13 | 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, |
20 | 22 | ) {
|
21 | 23 | case $ensure {
|
22 | 24 | '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}" |
24 | 27 | $unless_comp = '='
|
25 | 28 | }
|
26 | 29 | 'absent': {
|
|
0 commit comments