Ask Your Question

Managing the puppet service

asked 2014-03-20 15:20:14 -0600

Anil gravatar image

updated 2014-03-20 16:05:06 -0600

alextsr gravatar image

Hello All,

I wrote this class to manage the puppet service (ensure that it is running and starts on boot) based on OS family (getting it to work for solaris is important) and i would like to know if i am on the right path as i tried to import it into foreman and foreman has not found it. im wondering if something is missing.

path to the class /etc/puppet/environments/development/modules/puppetstart/manifests/init.pp

class puppetstart {
  case $::osfamily {
      service {"puppet":
        enable => true,
        ensure => "running",
      service {
        name   => "svc:/network/cswpuppetd:default",
        enable => true,
        ensure => "running",
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-03-21 11:49:41 -0600

domcleal gravatar image

There's a syntax error on line 14, where you've specified the name of the service under the Solaris branch, and so Foreman can't parse and import it.

If you run puppet parser validate /etc/puppet/environments/development/modules/puppetstart/manifests/init.pp then you'll see an error something like:

Error: Could not parse for environment production: All resource specifications require names; expected '%s' at /etc/puppet/environments/development/modules/puppetstart/manifests/init.pp:14

Change the Solaris resource to:

  service { "svc:/network/cswpuppetd:default":
    enable => true,
    ensure => "running",

And it should then import.

edit flag offensive delete link more

answered 2014-03-20 16:04:41 -0600

alextsr gravatar image

updated 2014-03-20 16:07:59 -0600

First of all, using puppet to ensure that puppet is running kind of beats the purpose, since puppet needs to be running in order to execute it. Unless, of course, you're running this specific class via puppet apply from Cron or something similar.

Now to the Foreman part. Foreman tries to autodetect your modules' location, but that might not always work. You can go to the Foreman settings, add that path manually and try importing again. The entry is called Puppet default module or something similar. (I don't have access to Foreman at the moment so I might ... (more)

edit flag offensive delete link more


thank you for your input on this it help and i have since resolved this issue. this is what the code now looks like. class puppetstart{ case $::osfamily { 'RedHat':{ service ...(more)

Anil gravatar imageAnil ( 2014-03-26 13:28:30 -0600 )edit

Great! but make sure you check @domcleal 's answer above since that one is the correct one for your question.

alextsr gravatar imagealextsr ( 2014-03-28 01:35:31 -0600 )edit

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-03-20 15:20:14 -0600

Seen: 479 times

Last updated: Mar 21 '14