Using PE Puppet Master Console to consolidate class parameter values

asked 2014-07-28 11:38:11 -0500

Red Cricket gravatar image

updated 2014-07-28 11:38:51 -0500

Hi,

I know that using heira would be the desired solution for my situation but I am supporting a group that only wants to use PE Puppet Master Console Groups for their entry data and node classification. I have setup that is similar to this contrived scenario.

Here are two classes:

modules/fooone/manifests/init.pp

class fooone (
   $value_one = 'default value 1',
   $value_two = 'default value 2',
) {
    file { '/tmp/fooone.txt':
        ensure => 'file',
        contents => "$value_one\n$value_two\n",
    }
}

modules/footwo/manifests/init.pp

class footwo (
   $value_one = 'default value 1',
   $value_two = 'default value 2',
) {
    file { '/tmp/footwo.txt':
        ensure => 'file',
        contents => "$value_one\n$value_two\n",
    }
}

In the PE Console we create groups: grp-fooone and grp-footwo. To grp-fooone we add the class fooone and to grp-footwo we add the class footwo. After that we add our nodes to either grp-fooone or grp-footwo. The problem is that, if someone changes the parameter value for $value_one via the PE Console for fooone and forgets to change $value_one for footwo, the files /tmp/fooone.txt and /tmp/footwo.txt won't match.

I tried to create a fooglobal class and refactor fooone and footwo like so:

modules/fooglobal/manifests/init.pp

class fooglobal (
   $value_one = 'default value 1',
   $value_two = 'default value 2',
) {}

modules/fooone/manifests/init.pp

class fooone inherits fooglobal {
    file { '/tmp/fooone.txt':
        ensure => 'file',
        contents => "$value_one\n$value_two\n",
    }
}

modules/footwo/manifests/init.pp

class fooone inherits fooglobal {        
    file { '/tmp/footwo.txt':
        ensure => 'file',
        contents => "$value_one\n$value_two\n",
    }
}

Then we create the group grp-fooglobal. Then we add the class fooglobal to grp-fooglobal and then add the groups grp-fooone and grp-footwo to grp-global. This works as no long as the default values for $value_one and $value_two are acceptable, but if we try to change the value of $value_one to "VALUE ONE" the change does not get reflected in the files /tmp/fooone.txt and /tmp/footwo.txt on the nodes that are in groups grp-fooone and grp-footwo. Is there a way to accomplish consolidation of class parameter in the PE Console?

edit retag flag offensive close merge delete