How to parameterize ntp service_ensure on puppet dashboard

34 views
Skip to first unread message

Stella

unread,
Aug 5, 2014, 6:27:36 PM8/5/14
to puppet...@googlegroups.com
Hi, I am trying to pass parameter from Dashboard to modules. For my own testing modules "createfile", it works fine: I can pass file_name variable value from Dashboard to it.

class createfile ($file_name=$::file_name) {

    file {"/tmp/${file_name}":
       ensure => present,
       mode   => 644,
       owner  => root,
       group  => root,
       content => "Hello, world2\n",
    }
}

However, now I am trying to do the same to NTP module and can't get it to work.
I downloaded the NTP module from Puppet Forge. I am trying to control the value of "service_ensure" from Dashboard, either "running" or "stopped".

The original structure is like this:

In init.pp, $service_ensure is defined as a global variable with :: in front of it:
class ntp (
  $service_ensure   = $ntp::params::service_ensure,

In service.pp, it points to the service_ensure varible:
 service { 'ntp':
      ensure     => $service_ensure,

In params.pp, it hardcoded the service_ensure as 'running"
$service_ensure = 'running'

So I thought I can just remove "running" from the params.pp and it should then take the value I placed on Dashboard.
But it doesn't work.

I tried many combinations and still can't get it to work.
Any clue?
Many thanks!

Stella

unread,
Aug 5, 2014, 8:08:09 PM8/5/14
to puppet...@googlegroups.com
Actually I installed another puppet agent and it works on this new agent...still not on the old agent...very interesting...

I leave init.pp and service.pp untouched, only modify params.pp

from
$service_ensure    = 'running'

to
$service_ensure    = "${::service_ensure}"

Will continue debugging why it works on one agent but not on the other...

Stella

unread,
Aug 6, 2014, 1:27:05 AM8/6/14
to puppet...@googlegroups.com
I figured out. On the Dashboard, I have set service_ensure = stopped inside the old agent, one layer down the group. Then somehow I totally forgot that setting and just changed the parameter value on the top layer. As a result, it is always overwritten by the value inside.
Reply all
Reply to author
Forward
0 new messages