A quick rundown of what we've learned in this chapter.
You can refer to or declare a number of identical resources concisely by giving them as an array:
package { [ 'php5-cli', 'php5-fpm', 'php-pear' ]: ensure => installed, }
You can group together resources of any type by using the define
keyword to create a definition:
define script_job() { RESOURCE1 RESOURCE2 ... }
You create an instance of a definition by declaring it just as though it were a built-in resource:
script_job { 'backup_database': }
Definitions can take parameters , if you specify them in () after the definition name:
define script_job( $hour, $minute ) {
...
}
You can make these parameters optional by giving default values for them:
define script_job( $hour = '00', $minute = '00' ) { ... }
To pass parameters to the definition, specify them just like normal resource attributes:
script_job { 'backup_database': hour => '05', minute => '30', }