-
Prefer
requiretobefore. -
Don't break encapsulation. In particular, a resource within one module should not create a dependency (require or notify) to a resource deep within another. For example,
File[/etc/nginx/sites-available/foo]from modulefooshould not directly notifyService[nginx]in modulenginx. Instead consider these options: -
use
containin modules to ensure dependencies are inherited to contained classes correctly, and specify the dependency at the top level. In our example, this means we would have:class {'foo': notify => Class['nginx']} class {'nginx':} -
create a defined type within one module which other modules can use which will set up the correct dependencies. See
nginx::config::sitefor an example -- this is a defined type which allows other modules to create an nginx configuration and will make sure it happens afternginx::packageand beforenginx::service, without the other module even knowing the existence of these classes. -
When a class includes or instantiates another class, consider whether you should use
containinstead ofincludeorclass. See the Puppet documentation. If classacontains classbthen any resource relationships made to classaalso apply to classb.
This repository was archived by the owner on Jan 30, 2024. It is now read-only.