Skip to content

Instantly share code, notes, and snippets.

@pulecp
Created November 20, 2014 15:45
Show Gist options
  • Save pulecp/9648e3ce736ec243c200 to your computer and use it in GitHub Desktop.
Save pulecp/9648e3ce736ec243c200 to your computer and use it in GitHub Desktop.
Classes Vs Defined Types
Classes Vs Defined Types
Classes are not to be thought of in the ‘object oriented’ meaning of a class. This means a machine belongs to a particular class of machine.
For instance, a generic webserver would be a class. You would include that class as part of any node that needed to be built as a generic webserver. That class would drop in whatever packages, etc, it needed to do.
Defined types on the other hand (created with ‘define’) can have many instances on a machine, and can encapsulate classes and other resources. They can be created using user supplied variables. For instance, to manage iptables, a defined type may wrap each rule in the iptables file, and the iptables configuration could be built out of fragments generated by those defined types.
Usage of classes and defined types, in addition to the built-in managed types, is very helpful towards having a managable Puppet infrastructure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment