diff --git a/site/profiles/manifests/base/datavol.pp b/site/profiles/manifests/base/datavol.pp index 5cb2a12..cf37f8e 100644 --- a/site/profiles/manifests/base/datavol.pp +++ b/site/profiles/manifests/base/datavol.pp @@ -2,6 +2,9 @@ # # This class manages the creation of a logical volume using the `lvm::volume` definition. # +# For LXC hosts, this is replaced with a mount added from the host os. This class will simply check the +# mountpoint exists. +# # Parameters: # $ensure - Ensure whether the logical volume is present or not. Defaults to 'present'. # $vg - Volume group name. No default. @@ -25,33 +28,48 @@ class profiles::base::datavol ( ]] $mount_options = ['noatime', 'nodiratime'], ) { - # Ensure the physical volume exists - physical_volume { $pv: - ensure => $ensure, - before => Volume_group[$vg], - } + if $facts['virtual'] != 'lxc' { - # Ensure the volume group exists - volume_group { $vg: - ensure => $ensure, - physical_volumes => [$pv], - before => Logical_volume[$lv], - } + # Ensure the physical volume exists + physical_volume { $pv: + ensure => $ensure, + before => Volume_group[$vg], + } - # Ensure the logical volume exists - logical_volume { $lv: - ensure => $ensure, - volume_group => $vg, - size => $size, - before => Filesystem["/dev/${vg}/${lv}"], - } + # Ensure the volume group exists + volume_group { $vg: + ensure => $ensure, + physical_volumes => [$pv], + before => Logical_volume[$lv], + } - # Ensure the filesystem is created on the logical volume - filesystem { "/dev/${vg}/${lv}": - ensure => $ensure, - fs_type => $fstype, - require => Logical_volume[$lv], - before => Mount[$mount], + # Ensure the logical volume exists + logical_volume { $lv: + ensure => $ensure, + volume_group => $vg, + size => $size, + before => Filesystem["/dev/${vg}/${lv}"], + } + + # Ensure the filesystem is created on the logical volume + filesystem { "/dev/${vg}/${lv}": + ensure => $ensure, + fs_type => $fstype, + require => Logical_volume[$lv], + before => Mount[$mount], + } + + # Ensure the logical volume is mounted at the desired location + mount { $mount: + ensure => $mountstate, + device => "/dev/${vg}/${lv}", + fstype => $fstype, + options => $mount_options.join(','), + require => [ + Filesystem["/dev/${vg}/${lv}"], + File[$mount] + ], + } } # Ensure the mountpath exists @@ -62,12 +80,4 @@ class profiles::base::datavol ( mode => '0755', } - # Ensure the logical volume is mounted at the desired location - mount { $mount: - ensure => $mountstate, - device => "/dev/${vg}/${lv}", - fstype => $fstype, - options => $mount_options.join(','), - require => Filesystem["/dev/${vg}/${lv}"], - } }