- Mastering Puppet 5
- Ryan Russell Yates Jason Southgate
- 147字
- 2021-07-16 17:46:14
Types
Go through the following steps to create your type:
- Create and distribute the type
- Add the namevar special attribute
- Add additional type properties
- Add the optional ensure property
- Add type parameters
- Set the property and parameter defaults
- Check the input value with a validate block
- Check the input value against a newvalues array
- Check datatype compatibility with munge
- Use AutoRequire for implicit relationships
- Use Arrays to list the values of an attribute
- Use the desc method to add inline documentation
Check out the official documentation page on Puppet types at https://puppet.com/docs/puppet/5.3/custom_types.html. Gary Larizza's blog also offers an alternative set of useful examples of types at http://garylarizza.com/blog/2013/11/25/fun-with-providers/.
Let's now go through each of these steps to create your new type in more detail in the following sections.