Ask Your Question
0

Learning puppet basic master/agent - invalid parameter ensure?

asked 2013-09-30 03:02:06 -0500

mahdeeb gravatar image

updated 2013-09-30 09:08:04 -0500

GregLarkin gravatar image

hello! I have gone through the learning puppet training, and I am on the last exercise. however, i need some help. when I do not insert a parameter in the class the agent node runs the puppet agent --test successfully. However, when I insert any parameter under class {'ntp':} the puppet agent --test run fails with invalid parameter. Why am I getting this error. In turn, how can I fix this?

here is what I put in site.pp:

node 'agent1.localdomain' {
  include apache
  class {'ntp':
    enabled => false,
    ensure => stopped,
  }
}

here is the ntp class:

class ntp ($servers = undef) {
  if ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-09-30 03:51:23 -0500

rahul khengare gravatar image

updated 2013-09-30 03:53:58 -0500

I think you missed the passing of parameters for ntp class, here you have to use the concept of parameterized classes.

Refer http://docs.puppetlabs.com/guides/parameterized_classes.html for detail concept of parameterized classes.

class ntp (
    $servers = undef,
    $ensure = undef,   # you can give the default value to $ensure parameters also as stopped,
    $enabled = undef,  # you can give the default value to $enabled parameters also as false,
    )
{
...
# main content
}

I hope this will solve your problem.

edit flag offensive delete link more

Comments

thanks for the feedback. one thing however. I added class parameters to the class definition (i.e. class {ntp: $ensure=running, $enable = false} which allowed the agent to run the ...(more)

mahdeeb gravatar imagemahdeeb ( 2013-09-30 13:37:59 -0500 )edit

I got it! i removed the values to the parameters in the class, then I replaced their values withing the manifest with the $ensure and $enable variables. NTP stopped!

mahdeeb gravatar imagemahdeeb ( 2013-09-30 13:45:18 -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

Stats

Asked: 2013-09-30 03:02:06 -0500

Seen: 1,844 times

Last updated: Sep 30 '13