A collection of task oriented solutions in Puppet

 

Deploy Custom Data Types from a module

Challenge

You want to deploy a custom data type.

Solution

$ find custom_datatype_module/
custom_datatype_module/
custom_datatype_module/types/                  # put custom data types in this directory
custom_datatype_module/types/mycustomtype.pp   # custom data type

# and here you can see the name space reflected in the custom data type
$ head -n 1 custom_datatype_module/types/mycustomtype.pp
type Custom_datatype_module::Mycustomtype = ...

Explanation

Deploying data types is as easy as placing them in the <MODULE>/types/ directory of your custom module. These will be autoloaded when the catalog is compiled, so either on the master or each agent in masterless mode, and made available to your puppet code. Here you can see a concrete example of a custom puppet data type module.

While it's tempting to have a longer, self explanatory, module name remember that you'll need to use this name every time you use one of the data types.

See also