Currently, module authors use a 'params class pattern' to provide defaults for the parameters their classes accept. A module for managing a database service mydb
, for example, will provide a class mydb::params
, which contains parameter assignments like $mydb::params::tcp_port
, $mydb::params::install_dir
, etc. These assignments can use the puppet DSL for conditional logic so that the install_directory
follows different OS' filesystem conventions appropriately. The parameter values are then used in the module's other classes, either in the prototype for the class or directly in the manifest:
class mydb::packages (
$tcp_port = $mydb::params::tcp_port,