Hi all,
I'm developing a sample puppet module, in which there are a few defined types in the main class of the module. These defined types are typically to install, configure and start a server. Was trying to improve pluggability of the module, by allowing users to perform custom resource management tasks between these functions:
ex.:
- at post install stage (after installing), create a file
- at post configure stage (after configuring), do some additional custom configurations, etc.
Considered the following options for this purpose:.
1. Use puppet function create_resources [1] to be run in each stages, where a user can pass a resource types and arguments to do custom stuff to the main module class [2].
2. Pass a name of a custom manifest and the arguments from the main module class and load the manifest. Again a user can do custom stuff inside this manifest [3].
WDYT of these approaches? Any better way to do this?
[1]. https://docs.puppet.com/puppet/latest/reference/function.html#createresources
[2].
notice("Resource [type] $name['type'], [data] $name['data']")
create_resources($name['type'], $name['data'])
[3].
class test ($custom_manifest_name) {
# install
include $custom_manifest_name
}
Thank you.
↧