easy_type
Robert scratched his head. How would he get a Puppet class to manage a complex resource on his systems? I guess I’ll have to make a Custom Type, he thought. But last time I looked into that, I noticed you need to know a lot about Puppet Internals.
If you recognize this thought process, easy_type is for you. Like the name says, easy type is designed to make it easy to build a Custom Puppet Type.
Tutorial
Check this blog post for a tutorial on using easy_type
.
Documentation
Check the rdoc documentation for easy_type
Get Started
To get started, you first need to install the easy_type
module.
$ puppet module install hajee/easy_type
Custom types need to be part of a module. So we need to have a module. You can create a module with the puppet module tool
$ puppet module generate robert/test_module
Creating a scaffold of your type
You can use easy_type
to create your custom type scaffold.
$ cd robert-test_module
$ puppet type scaffold easy_type my_type --force
This command creates a scaffold for you. The first parameter easy_type
specfies the type of custom type you are creating. At this point in time easy_type
supports:
- easy_type
- regular_type
The --force
creates any directories required en overwrites any existing files. We use it in this example because the lib/puppet
directory is not yet created.
Add a property
A custom type without a property is not very useful. So we need to create a property:
$ puppet type generate property my_property my_type
Edit your custom type
You can edit the code in lib/puppet/types/my_type.rb
and the ruby files in lib/puppet/types/my_type/
Spread the word
If you like easy_type, You can spread the word by adding a badge to the README.md file of your newly created type.
[](https://github.com/hajee/easy_type)
This will look like this:
License
MIT License
Contact
Bert Hajee hajee@moretIA.com
Support
Please log tickets and issues at our Projects site