Using resource defaults
Resource defaults allow you to specify the default attribute values for a resource. Resource defaults are valid for a given resource type and within the current scope. If you define a resource default in a class, then all resources of that type within the class will be given those defaults. In this example, we'll show you how to specify a resource default for the File
type.
How to do it...
To show you how to use resource defaults, we'll create an apache
module. Within this module, we will specify that all file resources require the httpd
package and the default owner
and group
are the apache
user:
- Create an
apache
module and create a resource default for theFile
type:
class apache { File { owner => 'apache', group => 'apache', mode => '0644', require => Package['httpd'] } package {'httpd': ensure => 'installed'} }
- Create
html
files within the/var/www/html
directory:
$index = @(INDEX) <html> <body> ...