Ask Your Question

running puppet class with params

asked 2015-10-15 15:11:45 -0500

drm509 gravatar image

updated 2015-10-15 15:12:13 -0500

I have a class like this in lumberjack_conf/manifests/init/pp:

class lumberjack_conf($params= ['"s/thst/hsth/var/log/files"']) {

which I can run with
puppet apply lumberjack_conf/tests/init.pp

What I'd like is to pass params on the command like .. sth like: puppet apply lumberjack_conf/tests/init.pp PARAM1

How do you pass params on the command line (or perhaps puppet dashboard?)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-15 19:31:06 -0500

ramindk gravatar image

Good question, I had to do a fair amount of research to figure this one out. The short answer is no, there is currently no way to do this. The long answer is you have two workarounds.

Use facter value declaration to create the vars. Something like the following should work.

FACTER_name::of::var1=value1 FACTER_name::of::var2=value2 puppet apply lumberjack_conf/tests/init.pp

Create a wrapper class and then apply it rather than the class you want to test directly.

class  testwrapper {
  class { lumberjack_conf:
     param1 => value1
edit flag offensive delete link more


My machine doesn't recognize FACTER_name as a valid command. Do I need to install sth for it? ` FACTER_name::of::params=['abc','def'] /usr/local/bin/puppet apply /home/drm/gitrepo/puppet/lumberjack_conf/tests/init.pp` Oh nm, I found out there is a tool called facter which I can't install ...

drm509 gravatar imagedrm509 ( 2015-10-16 08:07:46 -0500 )edit

.. due to puppet incompatibilities w this tool. I guess the wrapper class it is.

drm509 gravatar imagedrm509 ( 2015-10-16 08:32:59 -0500 )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: 2015-10-15 15:11:45 -0500

Seen: 108 times

Last updated: Oct 15 '15