From 25455229e15919ee2ec7b4882e685a6c5eafa06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 11 Jan 2021 01:07:46 -1000 Subject: [PATCH] Allow customizing files owner and group (#84) Use this to properly manage group on FreeBSD: we do not have a "root" group, the group with gid==0 is named "wheel". --- data/os/FreeBSD.yaml | 2 ++ manifests/files.pp | 14 ++++++++------ manifests/init.pp | 2 ++ manifests/lens.pp | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 data/os/FreeBSD.yaml diff --git a/data/os/FreeBSD.yaml b/data/os/FreeBSD.yaml new file mode 100644 index 0000000..b0c5b5e --- /dev/null +++ b/data/os/FreeBSD.yaml @@ -0,0 +1,2 @@ +--- +augeas::files_group: "wheel" diff --git a/manifests/files.pp b/manifests/files.pp index c73c19b..6b0b3c0 100644 --- a/manifests/files.pp +++ b/manifests/files.pp @@ -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. @@ -13,16 +15,16 @@ 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": @@ -30,7 +32,7 @@ purge => $::augeas::purge, force => true, mode => '0644', - owner => 'root', - group => 'root', + owner => $augeas::files_owner, + group => $augeas::files_group, } } diff --git a/manifests/init.pp b/manifests/init.pp index 105f7a1..3ad9d96 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, diff --git a/manifests/lens.pp b/manifests/lens.pp index d8a1a4e..06df46d 100644 --- a/manifests/lens.pp +++ b/manifests/lens.pp @@ -53,8 +53,8 @@ } File { - owner => 'root', - group => 'root', + owner => $augeas::files_owner, + group => $augeas::files_group, mode => '0644', }