Pls do suggest a simple example for creating a class using manifests

33 views
Skip to first unread message

yarlagadda ramya

unread,
Jan 15, 2013, 6:52:28 AM1/15/13
to puppet...@googlegroups.com
Hi all,

I have created two different manifests:
1) For moving a particular file from one directory to another using exec.
2)For renaming that same file using exec.

Now can you please suggest me the syntax for creating a class which applies these two manifests??  In Modules, actually a very complex example for class is given, which is a bit difficult to understand at very low level knowledge in puppet.

Kindly share if you have any solutions with you.

Jason Cochard

unread,
Jan 22, 2013, 4:55:13 PM1/22/13
to puppet...@googlegroups.com
You could wrap each of these with a class name, or combine them into one class.  Then include the class on the node you wish it to be applied to.  Example:

class myclass {
exec { "name1":
 command => /some/command/with/full/path
}
}

Then in your site.pp, for the node you want this applied to:

node mynode.mydomain.local {
include myclass
}

I wouldn't really get into a habit of using the exec command, as you will most likely end up doing really horrible hacks to get things to work, and that isn't really how puppet is meant to be applied, but that is the general idea of how you get a class applied to a node.  
Reply all
Reply to author
Forward
0 new messages