diff --git a/REFERENCE.md b/REFERENCE.md
index 0d7f0fdd..44c31fbd 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -127,6 +127,7 @@ The following parameters are available in the `consul` class:
* [`log_file`](#-consul--log_file)
* [`comment`](#-consul--comment)
* [`uid`](#-consul--uid)
+* [`gid`](#-consul--gid)
##### `acls`
@@ -610,6 +611,14 @@ the ID for the consul user
Default value: `undef`
+##### `gid`
+
+Data type: `Optional[Integer[1]]`
+
+the ID for the consul group
+
+Default value: `undef`
+
## Defined types
### `consul::check`
diff --git a/manifests/init.pp b/manifests/init.pp
index 603d14bb..8e9f2453 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -75,6 +75,7 @@
# @param log_file where should the log file be located
# @param comment the comment for the consul user, will be added to /etc/passwd
# @param uid the ID for the consul user
+# @param gid the ID for the consul group
#
# @example simple consul setup
# class { 'consul':
@@ -146,6 +147,7 @@
Boolean $allow_binding_to_root_ports = false,
Optional[String[1]] $comment = undef,
Optional[Integer[1]] $uid = undef,
+ Optional[Integer[1]] $gid = undef,
) inherits consul::params {
$real_download_url = pick(
$download_url,
diff --git a/manifests/install.pp b/manifests/install.pp
index e727640f..c1bc7b2b 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -119,6 +119,7 @@
group { $consul::group_real:
ensure => 'present',
system => true,
+ gid => $consul::gid,
}
}
}
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb
index c487bd3d..354ca43b 100644
--- a/spec/classes/init_spec.rb
+++ b/spec/classes/init_spec.rb
@@ -256,15 +256,17 @@
it { is_expected.to contain_user('consul').with(ensure: :present).without_home }
end
- context 'with uid and comment' do
+ context 'with uid and comment and gid' do
let :params do
{
uid: 2,
comment: 'this is a comment',
+ gid: 3,
}
end
it { is_expected.to contain_user('consul').with(ensure: :present).with_uid(2).with_comment('this is a comment') }
+ it { is_expected.to contain_group('consul').with(ensure: :present).with_gid(3) }
end
context 'When data_dir is provided' do