http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html#declaring-a-class-with-require
 

This might be what you are looking for. 


“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.” 
Bill Waterson (Calvin & Hobbes) 

----- Original Message -----
From: "Daniel Sage" <[email protected]> 
To: [email protected] 
Sent: Tuesday, October 29, 2013 1:23:02 AM 
Subject: [Puppet Users] Issues referencing a class from another module 



Hi all, 


I'm currently experiencing an issue where a module cannot reference a class 
from another module. 


Currently, I've got two modules, workstation and nfs and I'm attempting to use 
a class from the nfs module inside the workstation module, like so: 


Workstation module: 


class acme_inc::workstation { 


# ensure the local acme user exists 
user { "acme": 
ensure => present, 
uid => '1234', 
gid => 'acme', 
shell => '/bin/bash', 
home => '/home/$user_name', 
managehome => true, 
} 


... SNIP ... 


# install and set up the nfs client 
class {'nfs': 
class = "client", 
domain = "acme.example.com", 
} 
} 


NFS Module: 


class nfs ($class = 'client', $domain = '') { 


# install the class specific packages 
if $class == 'client' { 


# install client NFS packages 
package { 'nfs-common': 
ensure => installed, 
} 


} else { 

# install server NFS packages 
package { 'nfs-kernel-server': 
ensure => installed, 
} 
} 


# make sure that idmapd is running 
service { 'idmapd': 
name => $service_name, 
ensure => running, 
enable => true, 
subscribe => File['idmapd.conf'], 
} 


# generate and send the config file 
file { 'idmapd.conf': 
path => '/etc/idmapd.conf', 
ensure => file, 
require => Package['nfs-common'], 
content => template("nfs/idmapd.conf.erb"), 
} 
} 


Is what I intend to do something supported by puppet? or do I have to load the 
NFS module in the site manifest? Because my end goal is to create a module for 
each of my clients, where each module can then load say nginx::vhost to build 
that clients nginx virtual host. 


That way my server entry in site.pp is just: 


node 'server.example.com' { 


class {'ntp': 
servers => [ "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org", ], 
} 


include client1 
include client2 


} 


Again, is this possible in puppet, or do I have to scrap this idea and simply 
include all the client stuff inside the node definition? 


Any advise would be appreciated. 


Regards, 
Daniel Sage 

-- 
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 [email protected]. 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/cbdbfb44-643f-4eb4-bb73-f4db8c03c6c1%40googlegroups.com
 . 
For more options, visit https://groups.google.com/groups/opt_out . 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/85919935.4256496.1383052131837.JavaMail.root%40sz0126a.westchester.pa.mail.comcast.net.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to