Ask Your Question

Is there any good way how to execute just part of the module?

asked 2014-04-03 05:26:38 -0600

jaksky gravatar image

updated 2014-04-03 06:29:05 -0600


is there some good way how to execute just part of the module (some class)? I have a technological module which installs given technology. My init.pp contains the sequence how that is installed + bunch of variables needed for installation. Package is self contained.

Now I got into situation when I would need to create just configuration files - I would like to avoid duplicating code for configuration as it is essential to keep it in sync. Second - Do I need to include module if I just want to access variables defined in init.pp of that mdule?


edit retag flag offensive close merge delete


Do you mean that you have only the init.pp file. You could create sub-classes that would benefit from all the variables of the base class. The famous example is ...(more)

doc75 gravatar imagedoc75 ( 2014-04-03 06:51:55 -0600 )edit

No. I have an init.pp file and sub-classes dedicated for special purposes e.g. repository definitions, directories, installation, configuration etc. And sequence/ordering is defined in init.pp plus ...(more)

jaksky gravatar imagejaksky ( 2014-04-03 07:13:01 -0600 )edit

every time that I make a new module I make a separete class to parameters and variables if I need to just access them.

Renan Vicente gravatar imageRenan Vicente ( 2014-04-03 07:30:07 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-04-03 07:40:04 -0600

ffrank gravatar image

All resources are tagged with the name of the class they are defined in (among other things).

class tools::config {

To evaluate only resources from this class, use

puppet agent --test --tags tools::config
edit flag offensive delete link more


I moved my parameters to dedicated class: class pig::module_config { # DO NOT MODIFY $pig_user = 'pig' $pig_conf_dir = '/etc/pig/conf' $pig_log_dir = '/var/log/pig' $pig_pid_dir = '/var/run/pig' } from init.pp where those get replace with include pig::module_config. But the rest of code cannot access it now

jaksky gravatar imagejaksky ( 2014-04-30 09:27:08 -0600 )edit

Not sure what's going on there, but I feel that moving variables to a different class is unrelated. Please open a new question if that doesn't work for you. For the issue at hand, take care to seperate the *resources* that you want to sync independently into their dedicated class.

ffrank gravatar imageffrank ( 2014-04-30 15:17:02 -0600 )edit

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


Asked: 2014-04-03 05:26:38 -0600

Seen: 87 times

Last updated: Apr 03 '14