Merge pull request 'fix: datavol profile doesnt create the mountpoint' (#56) from neoloc/datavol_create_mountpath into develop

Reviewed-on: unkinben/puppet-prod#56
This commit is contained in:
Ben Vincent 2023-11-12 12:55:29 +09:30
commit 5276731d23

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