2

I am trying to include the puppet module (https://github.com/puppetlabs/puppetlabs-puppet/blob/master/manifests/init.pp) in my own common template module. But only set master => true for my master node. But I am receiving this error:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Only subclasses can override parameters at /etc/puppet/modules/template/manifests/puppetmaster.pp:5 on node puppet1.mydomain.com

My common template looks like:

class template::common {
  include ssh
  include user::infrastructure
  include user::system
  include packages::common
  class {
    'puppet' :
      puppet_server => 'puppet.mydomain.com',
  }
}

This is included in all my nodes (included my puppetmaster) which also includes this template:

class template::puppetmaster inherits puppet {
  include mysql::server
  include myfirewall::defaults
  Class['puppet'] { master +> true }

I'd like to be able to have just my puppet master install the master bit plus the agent (which is already inherited). But I would rather not have to define the puppet resource for every node just so I can have a separate resource of the same class for my puppet master.

What is a good way around this?

3
  • Could you please provide the content of puppet module?
    – quanta
    Sep 11, 2012 at 10:24
  • I added a link to the module on GitHub. You can see that params $agent and $master determine if they are installed. On a regular node I would only want to ensure agent. But on my master I would like both.
    – Andy Shinn
    Sep 11, 2012 at 15:43
  • In order to keep the agent class in the common template, the approach that I've taken is to split the master-related stuff into its own class. Would that be workable for you? If not, manually using the puppet::master class from the linked module might be another option. Sep 12, 2012 at 5:07

1 Answer 1

0

Answer the meta question of how do you make this work, If you're using Passenger to run your Puppet master, which you should if you've a system of any size, there is a simple workaround to the madness that is the puppetlabs module. You simply drop a new file called /etc/puppet/puppetmaster.conf and maybe some other bits of config in a new module called puppetmaster and also add this line to the config.ru

ARGV << "--config=/etc/puppet/puppetmaster.conf"

You can use some of the logic inside the puppetlabs module, but it might be simpler to just push a file or less complex template if you don't care about having every single bit of config as a parameter. Then include puppetmaster on the nodes that are masters and you're set. You can also modify the existing puppetlabs to do the above.

Addressing the original question, Hiera might be the simplest solution. Use this in the init.pp

$master                   = hiera('puppet_master','false'),

and then set puppet_master: true for the machines that need it. Personally my preference is for the first method.

1
  • I have started to get hiera setup in my environment and it looks like the a solution to this that will benefit me for other things down the road also.
    – Andy Shinn
    Sep 27, 2012 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .