From d11dcc0b24f7e79265301f6a971b4213469d246f Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 6 Nov 2023 19:23:52 +1100 Subject: [PATCH] fix: datavol profile doesnt create the mountpoint - add file resource to create the required mountpath - add Array[Enum[]] for mount_options - fix mount to ensure the mount_options are used - remove pass and dump options, leave as defaults --- site/profiles/manifests/base/datavol.pp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/site/profiles/manifests/base/datavol.pp b/site/profiles/manifests/base/datavol.pp index 167f60a..4384bb6 100644 --- a/site/profiles/manifests/base/datavol.pp +++ b/site/profiles/manifests/base/datavol.pp @@ -17,7 +17,11 @@ class profiles::base::datavol ( String $lv = 'data', Stdlib::Absolutepath $mount = '/data', Optional[Variant[Pattern[/^\d+(M|G|T|P)$/], Integer]] $size = undef, - Array $mount_options = ['noatime', 'nodiratime'], + Array[Enum[ + 'defaults', 'ro', 'rw', 'sync', 'async', + 'noatime', 'nodiratime', 'noexec', 'nosuid', + 'nodev', 'remount', 'auto', 'noauto' + ]] $mount_options = ['noatime', 'nodiratime'], ) { # Ensure the physical volume exists @@ -49,14 +53,20 @@ class profiles::base::datavol ( before => Mount[$mount], } + # Ensure the mountpath exists + file { $mount: + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + } + # Ensure the logical volume is mounted at the desired location mount { $mount: ensure => $ensure, device => "/dev/${vg}/${lv}", fstype => $fstype, - options => 'defaults', - dump => 0, - pass => 2, + options => $mount_options.join(','), require => Filesystem["/dev/${vg}/${lv}"], } }