Ask Your Question
0

Handling a Resource/Loading a Manifest Dynamically

asked 2016-08-22 04:33:12 -0600

izza gravatar image

updated 2016-08-22 05:44:34 -0600

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...

[2].

notice("Resource [type] $name['type'], [data] $name['data']")

create_resources($name['type'], $name['data'])

[3]. class test ($custommanifestname) {

# install

include $custommanifestname

}

Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-08-22 11:17:25 -0600

izza gravatar image

Just realized that its possible to pass a defined type to create_resources function [1]. Will be using that. Noting it here for someone's reference.

[1]. http://four-eyes.net/2013/09/puppet-p...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-08-22 04:33:12 -0600

Seen: 33 times

Last updated: Aug 22 '16