Skip to content

Commit

Permalink
Allow customizing files owner and group (#84)
Browse files Browse the repository at this point in the history
Use this to properly manage group on FreeBSD: we do not have a "root"
group, the group with gid==0 is named "wheel".
  • Loading branch information
smortex authored Jan 11, 2021
1 parent be1e874 commit 2545522
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions data/os/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
augeas::files_group: "wheel"
14 changes: 8 additions & 6 deletions manifests/files.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Sets up directories and files for Augeas
#
class augeas::files {
include augeas

$lens_dir = $augeas::lens_dir

# ensure no file not managed by puppet ends up in there.
Expand All @@ -13,24 +15,24 @@
recurse => true,
recurselimit => 1,
mode => '0644',
owner => 'root',
group => 'root',
owner => $augeas::files_owner,
group => $augeas::files_group,
}

file { "${lens_dir}/dist":
ensure => directory,
purge => false,
mode => '0644',
owner => 'root',
group => 'root',
owner => $augeas::files_owner,
group => $augeas::files_group,
}

file { "${lens_dir}/tests":
ensure => directory,
purge => $::augeas::purge,
force => true,
mode => '0644',
owner => 'root',
group => 'root',
owner => $augeas::files_owner,
group => $augeas::files_group,
}
}
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# ['lens_dir'] - the lens directory to use
# ['purge'] - whether to purge lens directories
class augeas (
String $files_owner = 'root',
String $files_group = 'root',
$version = present,
$ruby_package = $::augeas::params::ruby_pkg,
$ruby_version = present,
Expand Down
4 changes: 2 additions & 2 deletions manifests/lens.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
}

File {
owner => 'root',
group => 'root',
owner => $augeas::files_owner,
group => $augeas::files_group,
mode => '0644',
}

Expand Down

0 comments on commit 2545522

Please sign in to comment.