Ask Your Question

Node-specific configuration (multiple definition matching)

asked 2014-03-12 18:13:11 -0600

mzandstra gravatar image

updated 2014-03-13 14:05:49 -0600

I have been fighting with puppet for days and haven't yet figured out how to achieve what I want:

node /a[0-9]*/ {
  class { 'apache':
    default_mods => true,
    mpm_module   => 'itk',
    keepalive    => Off,
    timeout      => 60
  package { 'php5': }
  apache::mod { 'rewrite': }
  apache::mod { 'php5': }

This part works fine. Apache gets installed on anything I turn on starting with 'a'. Now I need to create node-specific virtualhost definitions, a la

node a1 {
  file { '/var/www/}':
    ensure => 'directory',
  file { '/var/www/':
    ensure => 'directory',
  file { '/var/www/':
    ensure => 'directory',
  apache::vhost { '':
    docroot => '/var/www/ ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-12 18:42:09 -0600

lavaman gravatar image

First, using nodes.pp is rather limiting and you should look at making use of an External Node Classifier sooner rather than later.

That being said, inheritance is probably failing because you're trying to inherit a node without a specific name. You should create a node called apache that has all the base apache stuff and have the other nodes inherit that. Then, keep your specific node definitions above the regex one in the nodes.pp. That way, it should match the specific nodes and then fall through to the regex node for anything not specifically defined.

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-03-12 18:13:11 -0600

Seen: 394 times

Last updated: Mar 13 '14