Ask Your Question

How to include my services/*.pp in my manifests/site.pp?

asked 2014-12-03 23:11:56 -0500

jeffreyw gravatar image

updated 2014-12-04 07:59:25 -0500

I read Puppet Best Practices and it mentions that the services should be located in another directory.. such as:


I have my modules written in


Assume I have a mysql module, and I need the service to be

service { 'mysql':
  ensure => running,
  enable => true,

The above service is written into a file:


Question: How would I be able to include that s_mysql.pp file into my manifests/site.pp?

I know I can include the mysql module by writing the following into manifests/site.pp:

include mysql

But I am unsure how I would do this for the service file (s_mysql.pp) that is located in a separate directory (since the import feature is deprecated)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-01-02 13:41:58 -0500

fnaard gravatar image

You're looking at some pretty old documentation there, but likely how the author solved it was with an import function that looked for the .pp wildcard. You see this in old code that was written in the Puppet 2 days. Here's the page on the import function -- as well as a couple ways to *avoid it.

I can't exactly tell, but you might be trying to solve a situation that would benefit from the Roles & Profiles design pattern. It would let you set up nodes with a single include .. which wraps up all the pieces that you need for a particular type of machine.


edit flag offensive delete link more

answered 2014-12-04 14:06:29 -0500

jonn gravatar image

Hi - that page is pretty old, and was an outline of how things were done at one particular site - the top of the page has this:

Please note: This represents a point in time, and the approach of one set of Puppet users. With the release of Puppetforge, a work is in progress to produce a standards and style guide that is up-to-date, and represents the consensus of the Puppet commuity.

The page suggests that you include /services/ in the puppet master's modulepath - but I don't think that the idea of a separate /services/ area is a very common pattern these days.

As an alternative, you may want to look into using roles and profiles - this is rapidly becoming the standard way to organise your modules into functional building blocks that will deliver a particular technology stack or business service.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-03 23:11:56 -0500

Seen: 108 times

Last updated: Jan 02 '15