O'Reilly logo

Puppet Essentials by Felix Frank

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Including classes from defined types

The example_app_config type that was defined in the previous example is supposed to serve a very specific purpose. Therefore, it assumes that the base directory, /etc/example_app, and its subdirectories were managed independently, outside the defined type. This was a sound design, but many defined types are meant to be used from lots of independent classes or other defined types. Such defines need to be self-contained.

In our example, the defined type needs to make sure that the following resources are part of the manifest:

file { 
    [ '/etc/example_app',
      '/etc/example_app/config.d.enabled' ]:
        ensure => 'directory';
}

Just putting this declaration into the body of the define will lead to duplicate resource errors. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required