require vs include?

4,078 views
Skip to first unread message

Larry Ludwig

unread,
Jun 14, 2011, 9:57:37 PM6/14/11
to puppet...@googlegroups.com
On a related note to my last post, what is the difference between a require and an include of a class?

Ken Barber

unread,
Jun 15, 2011, 9:02:18 AM6/15/11
to puppet...@googlegroups.com
Include just evaluates the class whereas a require creates a dependency:

http://docs.puppetlabs.com/references/stable/function.html#require

The difference is evident when the catalog needs to be applied. With
include you have evaluated its contents at the time of the include -
but any resources must be depended on explicitly after the include.
With a require - the dependency is created for you - but you have to
be careful and ensure that this is your desired result :-).

ken.

On Wed, Jun 15, 2011 at 2:57 AM, Larry Ludwig <larr...@gmail.com> wrote:
> On a related note to my last post, what is the difference between a require
> and an include of a class?
>

> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/9c4luY2KlDEJ.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

Reply all
Reply to author
Forward
0 new messages