Problem using resources and types from puppetlabs/lvm

702 views
Skip to first unread message

Andy Stevens

unread,
Aug 23, 2013, 10:07:55 AM8/23/13
to puppet...@googlegroups.com
Hi,

I'm struggling to make use of the resources and types provided by puppetlabs/lvm.

If I attempt to make use of the various resource types i.e. filesystem, lvm etc. from within my nodes.pp then I have no problem at all.  However if I attempt to reference them from a class I have created, when i invoke puppet agent --test I get the output below:

Error: Failed to apply catalog: Could not find dependency Filesystem[/dev/mapper/root_vg-WebSphere] for File.........

I'm guessing that my custom class can't see within it's scope the various resources and types provided by puppetlabs/lvm?  So how do I resolve this?  the puppetlabs/lvm isn't a class so I can't include it.

Any assistance would be greatly appreciated



Thanks

Andy

Chris McDermott

unread,
Aug 23, 2013, 11:20:32 AM8/23/13
to puppet...@googlegroups.com
I'm kind of guessing, but it might be that you need to push out the custom providers to the client. Try putting "pluginsync = true" in the [agent] section of your puppet.conf on that client, and try again.

Chris


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To post to this group, send email to puppet...@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Andy Stevens

unread,
Aug 27, 2013, 7:09:26 AM8/27/13
to puppet...@googlegroups.com
Chris,

Already have the pluginsync directive in the [agent] section of my puppet.conf - thanks for covering that off anyway.  I've included the relevant Puppet manifest snippets below as I could be doing something very very silly at a code level that someone could identify:

Firstly I have declared a class called 'websphere' which resides in /etc/puppet/modules/websphere and my class code is in the init.pp file located at /etc/puppet/modules/websphere/manifests. The code for this is as follows:

/etc/puppet/modules/websphere/manifests/init.pp

class websphere::deploy {


  include lvm::filesystem


  file { "/opt/wasadmin/backup/build_NdmBase.tar":

    source  => "puppet:///files/build/websphere/build_NdmBase.tar",

    mode    => 0640,

    owner   => "wasadmin",

    group   => "wasgrp",

    require => Filesystem[ "/dev/mapper/root_vg-WebSphere" ],

  }

}

The second component is my node definition which occurs on the nodes.pp file, as follows:

/etc/puppet/manifests/nodes.pp

node websphereNode inherits base {


  include websphere::deploy


}

The third component is actually specifying an instance of the above node, as follows:

/etc/puppet/manifests/nodes.pp

node "node.foo.com" inherits websphereNode {


}

I also have the puppetlabs/lvm module installed in the /etc/puppet/modules directory.

Hope the code I have included in this response is of assistance to someone to help me resolve this issue.

Thanks

Chris McDermott

unread,
Aug 27, 2013, 12:46:55 PM8/27/13
to puppet...@googlegroups.com
I don't see where you declare this resource:


    require => Filesystem[ "/dev/mapper/root_vg-WebSphere" ],



In order to require that, you would first need to declare it somewhere, for instance:

filesystem { '/dev/mapper/root_vg-WebSphere':
  ensure => present,
  fstype  => 'ext4',
}

Of course, that will only format a filesystem on that device node - it wouldn't set up a volume group or logical volume or mount point or anything else. In fact, I think a normal use of the puppetlabs-lvm module would look something more like this:

lvm::volume { 'WebSphere':
  ensure => present,
  pv        => '/dev/sdb',
  vg        => 'WebSphere',
  fstype  => 'ext4',
  before  => File['/opt/wasadmin'],
}

file { '/opt/wasadmin':
  ensure => directory
}

mount { '/opt/wasadmin':
  ensure => mounted,
  device  => '/dev/WebSphere/WebSphere',
  fstype  => 'ext4',
  require => File['/opt/wasadmin'],
}

And then in your websphere::deploy you could:

require => Mount['/opt/wasadmin']

And that would ensure that the whole stack was created - the physical volume, the volume group, the logical volume, the filesystem, and that it was mounted under /opt/wasadmin.

Chris
Reply all
Reply to author
Forward
0 new messages