Puppet is very extensible and allows you to create custom facts, functions, types and providers so that you can automate what you need to automate, how you need to automate it. But the beauty is that it all still uses the same Puppet DSL, so you have the same look and feel in your Puppet code for your users.
Types and providers
Types and providers can be easiest setup using the Resource API. Types refers to resource types, like some of the built-in file, package, service resource types. Providers are how to implement that type on the OS. If you hit limitations using the resource API, then you can look at the custom types and providers documentation.
Functions
Functions are a great way to extend Puppet to include custom functionality to perform calculations, lookups, conversions, or well just about anything. You do need to consider a few things first. Functions run on the primary server (formerly called a master), so you cannot do things on your nodes using functions. External calls with functions will have impacts on catalog compile times. Take a look at these docs on writing custom functions.
Custom facts
Facts can be used in numerous ways. Your custom facts can be distributed using pluginsync to your nodes and be used in your catalogs. Custom facts are distributed via a module in the module lib directory. If custom facts are very specific to a component, then often they are included with that component module. Enterprise-level custom facts are often distributed in an organization facts module, such a module may be named yourorganization-facts
to contain your organization’s specific facts.
One thing to consider if expanding to multiple operating systems, custom facts are pushed to all nodes and run on all nodes when facter gathers the list of facts. So if combining OS versions, you may wish to confine the fact execution to the operating systems that the fact is designed for.
Comments
0 comments
Please sign in to leave a comment.