Last Updated: February 25, 2016
·
401
· vintikjeny

Global resources options

Often, all resources of one type (file, package, service etc.) in one manifest have few common options. Instead of writing many strings of repetitive code like this:

file { "foo":
    ensure => file,
    mode => 600
    # some other code
}

file { "bar":
    ensure => file,
    mode => 600
    # some other code
}

file { "some_file":
    ensure => file,
    mode => 600
    # some other code
}

better set common options for all resources of one type in current class:

File {
    mode => 600
}

NOTE: name of type begins with a capital letter
This will produce better readability and less unnecessary code.