29be2f2e4d
v0.3.1 sha1: 71486f47598a397ee5c8e68b3cddc10dce86d0c4 Implements: blueprint merge-openstack-puppet-modules Change-Id: Ic050594a2aae82076a321c6298cc5e7f541d4884
60 lines
1.3 KiB
Puppet
60 lines
1.3 KiB
Puppet
define lvm::logical_volume(
|
|
$volume_group,
|
|
$size,
|
|
$ensure = present,
|
|
$options = 'defaults',
|
|
$fs_type = 'ext4',
|
|
$mountpath = "/${name}",
|
|
$mountpath_require = false,
|
|
) {
|
|
validate_bool($mountpath_require)
|
|
|
|
if $mountpath_require {
|
|
Mount {
|
|
require => File[$mountpath],
|
|
}
|
|
}
|
|
|
|
$mount_ensure = $ensure ? {
|
|
'absent' => absent,
|
|
default => mounted,
|
|
}
|
|
|
|
if $ensure == 'present' {
|
|
Logical_volume[$name] ->
|
|
Filesystem["/dev/${volume_group}/${name}"] ->
|
|
Mount[$mountpath]
|
|
} else {
|
|
Mount[$mountpath] ->
|
|
Filesystem["/dev/${volume_group}/${name}"] ->
|
|
Logical_volume[$name]
|
|
}
|
|
|
|
logical_volume { $name:
|
|
ensure => $ensure,
|
|
volume_group => $volume_group,
|
|
size => $size,
|
|
}
|
|
|
|
filesystem {"/dev/${volume_group}/${name}":
|
|
ensure => $ensure,
|
|
fs_type => $fs_type,
|
|
}
|
|
|
|
exec { "ensure mountpoint '${mountpath}' exists":
|
|
path => [ '/bin', '/usr/bin' ],
|
|
command => "mkdir -p ${mountpath}",
|
|
unless => "test -d ${mountpath}",
|
|
} ->
|
|
mount {$mountpath:
|
|
ensure => $mount_ensure,
|
|
device => "/dev/${volume_group}/${name}",
|
|
fstype => $fs_type,
|
|
options => $options,
|
|
pass => 2,
|
|
dump => 1,
|
|
atboot => true,
|
|
}
|
|
|
|
}
|