What's the difference between include and require in puppet
They are very different things, actually. To say require B
means B
must come before A
(and, therefore, can lead to circular dependencies if something in B
turns out to require A
). And if B
is not included at all, it will lead to missing dependencies error.
On the other hand, include B
just says B
will be applied whenever A
gets applied: it says nothing of the order between them.
This was just asked (and answered) on the puppet mailing list:
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 Barber in Require vs Include?