Skip to content

Commit ef70a6f

Browse files
authored
Merge pull request #241 from ody/addon_user_group
Set user and group for addon installation
2 parents 067a7d4 + c0e9ef9 commit ef70a6f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

manifests/addon.pp

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
# @param package_name
3535
# The OS package to install if you are not installing via splunk compatible archive
3636
#
37+
# @param owner
38+
# The user that files are owned by when they are created as part of add-on installation
39+
#
3740
# @param inputs
3841
# A hash of inputs to be configured as part of add-on installation, alterntively you can also define splunk_input or splunkforwarder_input resouces seperately
3942
#
@@ -42,6 +45,7 @@
4245
Boolean $package_manage = true,
4346
Optional[String[1]] $splunkbase_source = undef,
4447
Optional[String[1]] $package_name = undef,
48+
String[1] $owner = 'splunk',
4549
Hash $inputs = {},
4650
) {
4751

@@ -69,6 +73,8 @@
6973
$archive_name = $splunkbase_source.split('/')[-1]
7074
archive { $name:
7175
path => "${splunk::params::staging_dir}/${archive_name}",
76+
user => $owner,
77+
group => $owner,
7278
source => $splunkbase_source,
7379
extract => true,
7480
extract_path => "${_splunk_home}/etc/apps",
@@ -84,7 +90,11 @@
8490
}
8591
}
8692

87-
file { "${_splunk_home}/etc/apps/${name}/local": ensure => directory }
93+
file { "${_splunk_home}/etc/apps/${name}/local":
94+
ensure => directory,
95+
owner => $owner,
96+
group => $owner,
97+
}
8898

8999
$inputs.each |$section, $attributes| {
90100
$attributes.each |$setting, $value| {

0 commit comments

Comments
 (0)