lvm module help

191 views
Skip to first unread message

dkoleary

unread,
May 3, 2017, 11:01:10 AM5/3/17
to Puppet Users
Hey, all;

I'm having some trouble getting the lvm module to work the way I think it should based on my probable erroneous reading of the documentation.

I would like to ensure a logical volume of 2gs is created in vg00 which has plenty of free space to handle the lv creation.  I've been using this link as the guide:  


I'm using the puppetforge lvm module.

Hiera data looks like:

---
lvm
::volume_groups:
  vg00
:
    createonly
: true
    physical_volumes
:
     
/dev/sda2:
        unless_vg
: 'vg00'
    logical_volumes
:
      audit
:
        size
: 2G

I get this error when running on a test box:

# puppet agent -t
Notice: Local environment: 'production' doesn't match server specified node environment 'dkoleary', switching agent to 'dkoleary'.
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Lvm::Volume_group[vg00]: has no parameter named '
createonly' on node myhost.mydomain.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

If i comment the hiera data and specify the parameters directly in the class, it works:

# == Class: lvm
#
 
class lvm {


  physical_volume
{ '/dev/sda2':
   
ensure    => present,
    unless_vg
=> 'vg00',
 
}


  volume_group
{ 'vg00':
   
ensure           => present,
    physical_volumes
=> '/dev/sda2',
    createonly      
=> true,
 
}


  logical_volume
{ 'audit':
   
ensure       => present,
    size        
=> '2G',
    volume_group
=> 'vg00',
 
}
}
#======================================================================
# original init.pp code
#======================================================================
# class lvm (
#   $package_ensure = 'installed',
#   $manage_pkg     = undef,
#   $volume_groups  = {},
# ) {
#
#   if $manage_pkg {
#     package { 'lvm2':
#       ensure   => $package_ensure
#     }
#   }
#
#   validate_hash($volume_groups)
#
#   create_resources('lvm::volume_group', $volume_groups)
# }  
#======================================================================

results in:

# puppet agent -t
Notice: Local environment: 'production' doesn't match server specified node environment 'dkoleary', switching agent to 'dkoleary'.
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for cl1vproegit1395.multiplan.com
Info: Applying configuration version '
1493823333'
[[ Misc der'
mo snipped]]
Notice: /Stage[main]/Lvm/Logical_volume[audit]/ensure: created

Notice: Applied catalog in 94.15 seconds
                                               

# lvs vg00 |grep audit
  audit    vg00
-wi-a----- 2.00g              

I'd appreciate any hints/tips/suggestions on what I might be doing wrong.

Thanks for your time.

Doug O'Leary                        




Joshua Schaeffer

unread,
May 4, 2017, 10:53:18 AM5/4/17
to Puppet Users
You list volume_groups in Hiera (with an "s"):

---
lvm
::volume_groups:
  vg00
:
    createonly
: true
    physical_volumes
:
     
/dev/sda2:
        unless_vg
: 'vg00'
    logical_volumes
:
      audit
:
        size
: 2G

You list volume_group (without an "s") in your manifest:

create_resources('lvm::volume_group', $volume_groups)

If this is a typo in your copy/paste then it may be that Puppet cannot find the data in Hiera. Where do you define lvm::volume_groups in Hiera (common.yaml, node specific yaml file, etc)?

dkoleary

unread,
May 4, 2017, 11:08:22 AM5/4/17
to Puppet Users
I'll give that  try.  I was retyping/copying/pasting from the link directly, figuring the forge module handled that some how.  I appreciate the suggestion.

Thanks

Doug

dkoleary

unread,
May 4, 2017, 1:18:41 PM5/4/17
to Puppet Users
Hey;

Thanks again; unfortunately, that's not it.  volume_groups is set as a parameter to the lvm class:

class lvm (
  $package_ensure
= 'installed',
  $manage_pkg    
= undef,
  $volume_groups  = {},
) {


I tried it w/o the 's' anyways.  While the error went away, I didn't get my lv created either.  

Thanks again for the reply.

Doug O'Leary
Reply all
Reply to author
Forward
0 new messages