Using puppet classes in modules

350 Views Asked by At

I'm still fairly new to puppet, and am now at the point where I want to use classes with parameters in my custom modules.

I have a module called tsvpuppet, and I want it to act as a wrapper to the mysql module with standard paramters (maybe later on based on custom facts fromt he host).

in my /etc/puppet/modules/tsvmysql/manifests/init.pp file

class tsvmysql {
     class { '::mysql::server':
            root_password    => 'password',
            override_options => $override_options
           }
}

The above module code seems to work, but classes in classes just feels wrong.

Can anyone suggest a better way of writing this, or suggest how it should be done ?

Many thanks.

Matt

1

There are 1 best solutions below

1
On BEST ANSWER

You can include the class ::mysql::server.

class tsvmysql {
   include '::mysql::server'
}

class { '::mysql::server':
            root_password    => 'password',
            override_options => $override_options
}