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
This commit is contained in:
Ben Vincent 2023-11-06 19:23:52 +11:00
parent f5ce438679
commit d11dcc0b24

View File

@ -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}"],
}
}