pass values to puppet-lvm

1,906 views
Skip to first unread message

Luke

unread,
Jan 17, 2012, 9:56:44 AM1/17/12
to Puppet Users
i would like to use the module puppet-lvm and would like to pass
values to it.

I have it setup properly as a module but I can't for the lfe of me get
it to take any values that I put in my baseconfig.pp in my home
folder.

like shouldn't something like this work??

puppet-lvm {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
}


https://github.com/puppetlabs/puppet-lvm

Luke

unread,
Jan 20, 2012, 7:45:37 AM1/20/12
to Puppet Users
I am finding the documentation pretty poor on this. Can someone please
help?

I don't understand why I can't pass my variables.

Walter Heck

unread,
Jan 20, 2012, 6:27:55 PM1/20/12
to puppet...@googlegroups.com
Judging from the things you wrote here, you need a bit more
understanding of how puppet works with modules. Also, I see that that
specific module implements a define called lvm::volume, so your
manifest should be implementing a resource like so:

lvm::volume {'setvolume':


        vg => 'myvg',
        pv => '/dev/sdb',
        fstype => 'ext3',
        name => 'mylv',
        size =>'8G',
        }

best of luck!

Walter

> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>

--
Walter Heck

--
follow @walterheck on twitter to see what I'm up to!
--
Check out my new startup: Server Monitoring as a Service @ http://tribily.com
Follow @tribily on Twitter and/or 'Like' our Facebook page at
http://www.facebook.com/tribily

krish

unread,
Jan 21, 2012, 1:13:11 AM1/21/12
to puppet...@googlegroups.com
> like shouldn't something like this work??
>
> puppet-lvm {'setvolume':
>        vg => 'myvg',
>        pv => '/dev/sdb',
>        fstype => 'ext3',
>        name => 'mylv',
>        size =>'8G',
>        }
>
>
> https://github.com/puppetlabs/puppet-lvm

The module is has a define like this:
define lvm::volume($vg, $pv, $fstype = undef, $size = undef, $ensure) { ..

which means $ensure has no default value

also, it has a snip
"default: {
fail ( 'puppet-lvm::volume: ensure parameter can only be set to
cleaned, absent or present' )
}"

So if you dont provide an $ensure, it will fail with the above error.


Adding to Walter's snip ..

lvm::volume {'setvolume':


vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',

ensure => 'present',
}

--
Krish
www.toonheart.com

Luke

unread,
Feb 2, 2012, 2:53:42 PM2/2/12
to Puppet Users
Thank you for your help.

I am pretty new to puppet but am making some progress.

One question how do I get the:

lvm::volume {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
ensure => 'present',
}

To work within a node? I can pass variables to classes easy enough
within nodes but I can't seem to be able to get the nodes to do
anything with defined resource types.

Thanks again for the help.

On Jan 21, 2:13 am, krish <das.srikris...@gmail.com> wrote:
> > like shouldn't something like this work??
>
> > puppet-lvm{'setvolume':
> >        vg => 'myvg',
> >        pv => '/dev/sdb',
> >        fstype => 'ext3',
> >        name => 'mylv',
> >        size =>'8G',
> >        }
>
> >https://github.com/puppetlabs/puppet-lvm
>
> The module is has a define like this:
> definelvm::volume($vg, $pv, $fstype = undef, $size = undef, $ensure) { ..

jcbollinger

unread,
Feb 2, 2012, 3:51:46 PM2/2/12
to Puppet Users


On Feb 2, 1:53 pm, Luke <lutay...@gmail.com> wrote:
> Thank you for your help.
>
> I am pretty new to puppet but am making some progress.
>
> One question how do I get the:
>
> lvm::volume {'setvolume':
>          vg => 'myvg',
>          pv => '/dev/sdb',
>          fstype => 'ext3',
>          name => 'mylv',
>          size =>'8G',
>          ensure => 'present',
>          }
>
> To work within a node? I can pass variables to classes easy enough
> within nodes but I can't seem to be able to get the nodes to do
> anything with  defined resource types.
>
> Thanks again for the help.

If you are writing node definitions by hand, for example in a nodes.pp
manifest, then you should be able to just put that code snippet inside
one or more of them:

node 'mynode' {
lvm::volume {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
ensure => 'present',
}
}

If you are using an external node classifier (ENC) such as Foreman or
the Puppet Dashboard, however, then you need to know that the ENC
interface does not support assigning ordinary resources to nodes.
With an ENC, everything has to be bundled into classes.


John

Luke

unread,
Feb 3, 2012, 7:33:30 AM2/3/12
to Puppet Users
Hmmm that is what I have been doing but for some reason it keeps
messing up. Do I have to do an include or something for the puppet-lvm
module? I mean I already have an import statement for it in my
sites.pp.

Felix Frank

unread,
Feb 3, 2012, 7:59:11 AM2/3/12
to puppet...@googlegroups.com
Hi,

On 02/03/2012 01:33 PM, Luke wrote:
> Hmmm that is what I have been doing but for some reason it keeps
> messing up. Do I have to do an include or something for the puppet-lvm
> module? I mean I already have an import statement for it in my
> sites.pp.

please share a relevant excerpt from your manifest.

Is an error generated? Please share that as well.

Thanks,
Felix

Luke

unread,
Feb 3, 2012, 8:37:12 AM2/3/12
to Puppet Users
Hi,

site.pp

manifests]$ cat site.pp
import "nodes"
import "modules"

----------------

manifests]$ cat modules.pp
import "lvm"
----------------

cat nodes.pp
node 'luketest.mgmt.mydomain.local' {

lvm::volume {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
ensure => 'present',
}
}

---------------

The module was originally named puppet-lvm I tried renaming to lvm

but it doesn't matter get the same results

Does the following:

When I name the module lvm. I applys the config but doesn't do
anything.
info: Caching catalog for luketest.mgmt.mydomain.local
info: Applying configuration version '1328241141'
notice: Finished catalog run in 0.03 seconds
----------------

manifests]$ cat modules.pp
import "puppet-lvm"
----------------

cat nodes.pp
node 'luketest.mgmt.mydomain.local' {

lvm::volume {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
ensure => 'present',
}
}

------------
I also tried the following:

cat nodes.pp
node 'luketest.mgmt.mydomain.local' {

puppet-lvm::lvm::volume {'setvolume':
vg => 'myvg',
pv => '/dev/sdb',
fstype => 'ext3',
name => 'mylv',
size =>'8G',
ensure => 'present',
}
}

---------

but got the following error:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type puppet-lvm::lvm::volume at /srv/puppet/manifests/
nodes.pp:10 on node luketest.mgmt.mydomain.local
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run


On Feb 3, 8:59 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

Felix Frank

unread,
Feb 3, 2012, 8:42:01 AM2/3/12
to puppet...@googlegroups.com
Hi,

On 02/03/2012 02:37 PM, Luke wrote:
> When I name the module lvm. I applys the config but doesn't do
> anything.
> info: Caching catalog for luketest.mgmt.mydomain.local
> info: Applying configuration version '1328241141'
> notice: Finished catalog run in 0.03 seconds

please repeat with --evaltrace.

Is it supposed to be doing anything?

If evaltrace isn't concluse, you may want to add -dv.

Finally, you can even inspect the catalog in /var/lib/puppet. If it
doesn't mention your LV, something is wrong indeed.

HTH,
Felix

Luke

unread,
Feb 3, 2012, 8:51:06 AM2/3/12
to Puppet Users
[root@luketest ~]# puppet agent --test --evaltrace
info: Caching catalog for luketest.mgmt.mydomain.local
info: Applying configuration version '1328245279'
info: /Schedule[puppet]: valuated in 0.00 seconds
info: /Filebucket[puppet]: valuated in 0.00 seconds
info: /Schedule[never]: valuated in 0.00 seconds
info: /Schedule[daily]: valuated in 0.00 seconds
info: /Schedule[weekly]: valuated in 0.00 seconds
info: /Schedule[monthly]: valuated in 0.00 seconds
info: /Schedule[hourly]: valuated in 0.00 seconds
info: /Whit[/dev/sdb]: valuated in 0.00 seconds
info: /Whit[myvg]: valuated in 0.00 seconds
info: /Whit[mylv]: valuated in 0.00 seconds
info: /Whit[/dev/myvg/mylv]: valuated in 0.00 seconds
notice: Finished catalog run in 0.04 seconds

with dv
--------------------------

debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/
dscl does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does
not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
debug: Failed to load library 'rubygems' for feature 'rubygems'
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature
microsoft_windows is missing
debug: /File[/var/lib/puppet/state/last_run_summary.yaml]:
Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/
var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/
lib/puppet/state]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/
lib/puppet]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/private_keys/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/private_keys]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/
lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/certs/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/certs]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/classes.txt]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/
puppet/ssl]
debug: Finishing transaction 23937560695320
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/
var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/
lib/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/certs]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/
luketest.mgmt.mydomain.local.pem]: Autorequiring File[/var/lib/puppet/
ssl/private_keys]
debug: Finishing transaction 23937559797080
debug: Using cached certificate for ca
debug: Using cached certificate for luketest.mgmt.mydomain.local
debug: Finishing transaction 23937559374540
debug: Loaded state in 0.00 seconds
debug: Using cached certificate for ca
debug: Using cached certificate for luketest.mgmt.mydomain.local
debug: Using cached certificate_revocation_list for ca
debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw
yaml; using pson
info: Caching catalog for luketest.mgmt.mydomain.local
debug: Creating default schedules
debug: Loaded state in 0.00 seconds
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Volume_group[myvg]/require: requires
Physical_volume[/dev/sdb]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Logical_volume[mylv]/require: requires
Volume_group[myvg]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Filesystem[/dev/myvg/mylv]/require: requires
Logical_volume[mylv]
info: Applying configuration version '1328245279'
info: /Schedule[monthly]: valuated in 0.00 seconds
info: /Schedule[daily]: valuated in 0.00 seconds
info: /Filebucket[puppet]: valuated in 0.00 seconds
info: /Schedule[never]: valuated in 0.00 seconds
info: /Schedule[puppet]: valuated in 0.00 seconds
info: /Whit[/dev/sdb]: valuated in 0.00 seconds
info: /Whit[myvg]: valuated in 0.00 seconds
info: /Whit[mylv]: valuated in 0.00 seconds
info: /Whit[/dev/myvg/mylv]: valuated in 0.00 seconds
info: /Schedule[hourly]: valuated in 0.00 seconds
info: /Schedule[weekly]: valuated in 0.00 seconds
debug: Finishing transaction 23937559969500
debug: Storing state
debug: Stored state in 0.00 seconds
notice: Finished catalog run in 0.03 seconds

-----------

hmmm I mean I have the HD added to the vm and I can see /dev/sdb

So maybe I am doing everything right but it has something to do with
the vm config itself?


On Feb 3, 9:42 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

Luke

unread,
Feb 3, 2012, 8:53:01 AM2/3/12
to Puppet Users
This is the module here that I am trying to get working:

https://github.com/puppetlabs/puppet-lvm

Felix Frank

unread,
Feb 3, 2012, 8:55:19 AM2/3/12
to puppet...@googlegroups.com
On 02/03/2012 02:51 PM, Luke wrote:
> info: /Whit[/dev/sdb]: valuated in 0.00 seconds
> info: /Whit[myvg]: valuated in 0.00 seconds
> info: /Whit[mylv]: valuated in 0.00 seconds
> info: /Whit[/dev/myvg/mylv]: valuated in 0.00 seconds

Looks like it's working all right. But seeing as the LV exists already,
puppet doesn't need to do anything.

Try and add a new LV in the manifest, watch puppet create it.

HTH,
Felix

Luke

unread,
Feb 3, 2012, 9:04:03 AM2/3/12
to Puppet Users
Hi Felix,

Thats the thing the LV doesn't exist so I don't know why it is acting
like it does:

Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1305 10377990 8e Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Its not even doing anything with /dev/sdb.

It makes me wonder if I am going about implementing it correctly.

Thanks for the help Felix,

On Feb 3, 9:55 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

Luke

unread,
Feb 3, 2012, 9:07:37 AM2/3/12
to Puppet Users
It doesn't matter what I put in it does the same thing:

debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Filesystem[/dev/awesomevg/awesomename]/require:
requires Logical_volume[awesomename]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Logical_volume[awesomename]/require: requires
Volume_group[awesomevg]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Volume_group[awesomevg]/require: requires
Physical_volume[/dev/sdb

I can even put in a random pv that doesn't exist and it still is all
fat dumb and happy:

debug: Creating default schedules
debug: Loaded state in 0.00 seconds
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Filesystem[/dev/awesomevg/awesomename]/require:
requires Logical_volume[awesomename]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Volume_group[awesomevg]/require: requires
Physical_volume[/dev/awesome]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Logical_volume[awesomename]/require: requires
Volume_group[awesomevg]

Felix Frank

unread,
Feb 3, 2012, 9:07:46 AM2/3/12
to puppet...@googlegroups.com
Hi,

On 02/03/2012 03:04 PM, Luke wrote:
> Disk /dev/sdb: 8589 MB, 8589934592 bytes
> 255 heads, 63 sectors/track, 1044 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
>
> Disk /dev/sdb doesn't contain a valid partition table
>
> Its not even doing anything with /dev/sdb.

What makes you so certain? :-)

Output of pvs and lvs, please.

Thanks,
Felix

Luke

unread,
Feb 3, 2012, 9:45:37 AM2/3/12
to Puppet Users
Here you go

root@luketest ~]# pvdisplay
/dev/hdc: open failed: No medium found
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup00
PV Size 9.90 GB / not usable 22.76 MB
Allocatable yes (but full)
PE Size (KByte) 32768
Total PE 316
Free PE 0
Allocated PE 316
PV UUID npQup3-Fhv6-bNA3-87HF-P9tt-9Z6n-FMbJ5W

root@luketest ~]# lvdisplay
/dev/hdc: open failed: No medium found
--- Logical volume ---
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID wI6rkP-wlsM-rngt-TsWZ-HLjr-A0S7-eJibXD
LV Write Access read/write
LV Status available
# open 1
LV Size 9.12 GB
Current LE 292
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID CplThy-JVyJ-wcgh-ldMY-KDo8-lT2s-aHV8Nq
LV Write Access read/write
LV Status available
# open 1
LV Size 768.00 MB
Current LE 24
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

On Feb 3, 10:07 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

jcbollinger

unread,
Feb 3, 2012, 9:58:13 AM2/3/12
to Puppet Users


On Feb 3, 7:37 am, Luke <lutay...@gmail.com> wrote:
> Hi,
>
> site.pp
>
> manifests]$ cat site.pp
> import "nodes"


That import is appropriate.


> import "modules"


That one should not be needed.


> ----------------
>
> manifests]$ cat modules.pp
> import "lvm"


That whole manifest should not be need.


> ----------------
>
> cat nodes.pp
> node 'luketest.mgmt.mydomain.local' {
>
> lvm::volume {'setvolume':
>          vg => 'myvg',
>          pv => '/dev/sdb',
>          fstype => 'ext3',
>          name => 'mylv',
>          size =>'8G',
>          ensure => 'present',
>          }
>
> }


That node definition is fine.

The other part of the problem is likely your module structure and
location. The name of your defined type places it in module "lvm",
but for Puppet to automatically *find* that module -- and within it
that definition -- you need to structure your module correctly and put
it in the right place. With the default module path, the structure
should look like this:

(puppet base dir)/
L manifests/
L nodes.pp
L site.pp
L modules/
L lvm/
L manifests/
L init.pp (may be empty)
L volume.pp (contains lvm::volume)


John

Luke

unread,
Feb 3, 2012, 10:31:26 AM2/3/12
to Puppet Users
Hi John,

I did exactly what you said and got the same result:

debug: Creating default schedules
debug: Loaded state in 0.00 seconds
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Volume_group[myvg]/require: requires
Physical_volume[/dev/sdb]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Logical_volume[mylv]/require: requires
Volume_group[myvg]
debug: /Stage[main]//Node[luketest.mgmt.mydomain.local]/
Lvm::Volume[setvolume]/Filesystem[/dev/myvg/mylv]/require: requires
Logical_volume[mylv]



Felix Frank

unread,
Feb 3, 2012, 10:40:42 AM2/3/12
to puppet...@googlegroups.com
On 02/03/2012 03:45 PM, Luke wrote:
> root@luketest ~]# pvdisplay

Ugh, why do people insist on using this instead of pvs?

Anyway, you're right, the LV isn't there. Neither is the PV.

Are the PV and VG defined somewhere in your manifest? They should be. I
have no experience with this module, but maybe it silently ignores LVs
which it cannot create due to the missing VG.

Luke

unread,
Feb 3, 2012, 12:30:07 PM2/3/12
to Puppet Users
The PV and VG are not defined anywhere else that I can see.

On Feb 3, 11:40 am, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

Luke

unread,
Feb 3, 2012, 12:37:43 PM2/3/12
to Puppet Users
Just to have it out in the open:

Here is the manifest from the lvm module

define lvm::volume($vg, $pv, $fstype = undef, $size = undef, $ensure)
{
case $ensure {
#
# Clean up the whole chain.
#
cleaned: {
# This may only need to exist once
if ! defined(Physical_volume[$pv]) {
physical_volume { $pv: ensure => present }
}
# This may only need to exist once
if ! defined(Volume_group[$vg]) {
volume_group { $vg:
ensure => present,
physical_volumes => $pv,
before => Physical_volume[$pv]
}

logical_volume { $name:
ensure => present,
volume_group => $vg,
size => $size,
before => Volume_group[$vg]
}
}
}
#
# Just clean up the logical volume
#
absent: {
logical_volume { $name:
ensure => absent,
volume_group => $vg,
size => $size
}
}
#
# Create the whole chain.
#
present: {
# This may only need to exist once
if ! defined(Physical_volume[$pv]) {
physical_volume { $pv: ensure => present }
}

# This may only need to exist once
if ! defined(Volume_group[$vg]) {
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]
}

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

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

Felix Frank

unread,
Feb 3, 2012, 12:42:30 PM2/3/12
to puppet...@googlegroups.com
On 02/03/2012 06:37 PM, Luke wrote:
> if ! defined(Physical_volume[$pv]) {
> physical_volume { $pv: ensure => present }
> }

Ah, dreadful ;-)

But there goes that theory - the PV and VG are implicitly created, so
the module really *should* do the right thing.

So the issue is probably with the provider(?)
I'm stumped.

Felix

Luke

unread,
Feb 3, 2012, 12:59:45 PM2/3/12
to Puppet Users
Oh well. Maybe this lvm module doesn't like centos or something :(

Thanks for all your help Felix. If anyone else has any ideas or better
lvm type modules please drop a line.

On Feb 3, 1:42 pm, Felix Frank <felix.fr...@alumni.tu-berlin.de>
wrote:

Luke

unread,
Feb 6, 2012, 12:23:16 PM2/6/12
to Puppet Users
How does everyone else manage LVM on centos? Do you do it manually? Do
you have a shell script? Some how through puppet?

On Feb 3, 1:59 pm, Luke <lutay...@gmail.com> wrote:
> Oh well. Maybe thislvmmodule doesn't like centos or something :(
>
> Thanks for all your help Felix. If anyone else has any ideas or betterlvmtype modules please drop a line.

jcbollinger

unread,
Feb 7, 2012, 9:00:52 AM2/7/12
to Puppet Users


On Feb 6, 11:23 am, Luke <lutay...@gmail.com> wrote:
> How does everyone else manage LVM on centos? Do you do it manually? Do
> you have a shell script? Some how through puppet?

I do it manually. If I had to do a lot of identical boxes then I
might script it, maybe via kickstart, but it's not the sort of thing I
normally look to Puppet to manage for me. In particular:

1) It's almost exclusively a provisioning issue -- the LVM
configuration should not need to be managed after it is initially set
up
2) If somehow the LVM configuration on one of my nodes got messed up,
no way would I want Puppet to try to fix it automatically

Also,

3) My own usual configuration puts Puppet on a logical volume, so I
would have a chicken-and-egg problem if I wanted Puppet to set that
up.


John

Denmat

unread,
Feb 7, 2012, 2:06:58 PM2/7/12
to puppet...@googlegroups.com
And I kickstart and script (%post kickstart section) where possible but I'm going to look into the lvm module after finding it a couple of days ago - for partitions I don't plan on hosts I can't rebuild.

HTH
Den

C R Ritson

unread,
Feb 8, 2012, 4:42:39 AM2/8/12
to puppet...@googlegroups.com
It's bound to be sub-optimal, but I too found puppet-lvm hard to get started with. Firstly, I took a long time to discover that I needed to set pluginsync to get the module copied to all hosts:-

augeas { "puppet-pluginsync":
context => "/files/etc/puppet/puppet.conf/main",
changes => "set pluginsync true",
# notify => Service[puppet],
}

In this, the notify is commented out. It shouldn't be, but until I can upgrade to 2.7, I think I am being bitten by an old bug which prevents the daemon being restarted. I couldn't make parameterisation work.

Secondly, like another poster, my initial host setup creates system volumes with kickstart. I use puppet to add subsequent data volumes which may be required for a specific project. I have given up trying to parameterise this, so it is less than flexible. One example, for a project-specific equivalent of /tmp is split into two parts:-

class lvm_a3 {
import "puppet-lvm"

physical_volume { "/dev/sda3" :
ensure => present,
}

volume_group { "vga" :
ensure => present,
physical_volumes => "/dev/sda3",
}

Physical_volume["/dev/sda3"] -> Volume_Group["vga"]

}

class lvm_gypsy {

Volume_group["vga"] -> Logical_volume["gypsy"]
Logical_volume["gypsy"] -> Filesystem["/dev/vga/gypsy"]
Filesystem["/dev/vga/gypsy"] -> Mount["/export/space/gypsy"]
File["/export"] -> File["/export/space"]
File["/export/space"] -> File["/export/space/gypsy"]
File["/export/space/gypsy"] -> Mount["/export/space/gypsy"]
Mount["/export/space/gypsy"] -> File["/export/space/gypsy/tmp"]

logical_volume { "gypsy" :
ensure => present,
volume_group => "vga",
size => "50G",
}

filesystem { "/dev/vga/gypsy" :
ensure => present,
fs_type => "ext3",
}

file { "/export" :
ensure => directory,
mode => "644",
}

file { "/export/space" :
ensure => directory,
mode => "644",
}

file { "/export/space/gypsy" :
ensure => directory,
mode => "611",
}

mount { "/export/space/gypsy" :
atboot => true,
device => "/dev/vga/gypsy",
ensure => mounted,
fstype => "ext3",
options => "defaults,nofail",
name => "/export/space/gypsy",
dump => "0",
pass => "1",
}

file { "/export/space/gypsy/tmp" :
ensure => directory,
owner => "root",
mode => "1777",
}

tidy { "/export/space/gypsy/tmp":
age => "36h",
recurse => inf,
type => mtime,
}

import "puppet-lvm"
}

These two classes are one-per-file. You will see that the second one goes on to tidy up stale scratch files...

Chris Ritson (Computing Officer and School Safety Officer)

Room 707, Claremont Tower, EMAIL: C.R.R...@ncl.ac.uk
School of Computing Science, PHONE: +44 191 222 8175
Newcastle University, FAX : +44 191 222 8232
Newcastle upon Tyne, UK NE1 7RU. WEB : http://www.cs.ncl.ac.uk/


Matt

unread,
Feb 29, 2012, 3:41:22 AM2/29/12
to Puppet Users
I get the same problem with CentOS.
No error but no LV created.

I've tried with Ubuntu client and same issue.

Something might be wrong within the module...

Matt

On Feb 4, 1:59 am, Luke <lutay...@gmail.com> wrote:
> Oh well. Maybe thislvmmodule doesn't like centos or something :(
>
> Thanks for all your help Felix. If anyone else has any ideas or betterlvmtype modules please drop a line.
Reply all
Reply to author
Forward
0 new messages