Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ be shortened to be:

volume("myvg", "/dev/hdc", "mylv", "ext3", "20G")

If you want to omit the file system type, but still specify the size of the
logical volume, i.e. in the case if you are planning on using this logical
volume as a swap partition or a block device for a virtual machine image, you
need to use a hash to pass the parameters to the definition.

If you need a more complex configuration, you'll need to build the
resources out yourself.

Expand Down
8 changes: 6 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define lvm::volume($vg, $pv, $fstype, $size = undef, $ensure) {
define lvm::volume($vg, $pv, $fstype = undef, $size = undef, $ensure) {
case $ensure {
#
# Clean up the whole chain.
Expand All @@ -21,7 +21,11 @@
physical_volume { $pv: ensure => present }
volume_group { $vg: ensure => present, physical_volumes => $pv, require => Physical_volume[$pv] }
logical_volume { $name: ensure => present, volume_group => $vg, size => $size, require => Volume_group[$vg] }
filesystem { "/dev/${vg}/${name}": ensure => present, fs_type => $fstype, require => Logical_volume[$name] }

if $fstype != undef {
filesystem { "/dev/${vg}/${name}": ensure => present, fs_type => $fstype, require => Logical_volume[$name] }
}

}
default: {
fail ( 'puppet-lvm::volume: ensure parameter can only be set to cleaned, absent or present' )
Expand Down