Ask Your Question
0

differentiate define with virtual resource type with an example?

asked 2015-11-23 04:14:11 -0500

yoga gravatar image

kindly explain me about the differences between define and virtual resources with example. in which situations we using define and virtual resource type?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-24 19:09:37 -0500

GregLarkin gravatar image

Virtual resources are pretty well documented here: https://docs.puppetlabs.com/puppet/latest/reference/lang_virtual.html

Essentially, they let you define a resource to be later inserted into the catalog only when instructed to do so with the realize function or with a resource collector. They function similar to the way that you can define a class and then include it into the catalog in many different places without triggering a duplicate declaration error.

Defined resource types are simply a wrapper around a number of other resources so you can refer to a group with some kind of shorthand that makes more sense to you. This page has the complete documentation:

https://docs.puppetlabs.com/puppet/latest/reference/langdefinedtypes.html

I've never tried it, but I don't think there's any reason that a defined resource type couldn't also include a virtual resource definition or declaration. I haven't seen that in any code I'm come across, either.

I hope that helps, but if you have further questions, please post them here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-23 04:12:57 -0500

Seen: 125 times

Last updated: Nov 24 '15