Hi all,

I have been kinda stuck with the following few issues (all related to one
and other)

What I want ot ddo is define a couple of standard actions in puppet that I
can use across all my classes.
So for example I define a exec for apt-get update , or a reload. When built
in to a class it works fine I would just have to redeclare it with an other
name in the next class and I want to get away from it.

Now I have started working on importing it via my site.pp but I can not
define say the exec for "service $service_name reload", it will generate an
error when I include it : Must pass service_name to Class[Defaults] (class
defaults being the collective class I brought all these snippets together)

So question one am I on the right path in creating this , using the top
scope prinocipal in my design for this.

Second question how do I pass a variable in this setup , as I can not
include the class in site.pp as it will generate the "must pass error" but
just doing an import in my site.pp and then an include in my module init.pp
does not actually work either but then silentlly.

I am missing somethign I think just not sure what and where .

Here below the code snippets of what I am doing.

site.pp in /etc/puppet/environments/dev/manifests/
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }

import 'classes/*.pp'

the defaults.pp with the class from
/etc/puppet/environments/dev/manifests/classes/ :
class defaults ( $service_name ){

         case $::operatingsystem {
                 debian, ubuntu: {
                         exec { "apt update":
                                 command => "/usr/bin/apt-get update",
# onlyif => < snipped >

         exec { "reload":
                 command => "/usr/sbin/service $service_name reload",
                 refreshonly => true,
                 require => Service[[$service_name]],

         exec { "restart":
                 command => "/usr/sbin/service $service_name restart",
                 refreshonly => true,
                 require => Service[[$service_name]],


And the class calling it from

include defaults

class pdns_33 ( $mysql_password, $srv_type, $web_password ) {
<-- snipped -->
        file { "/etc/powerdns/pdns.conf":
                 ensure => present,
                 owner => root,
                 group => root,
                 mode => 644,
                 content => template("pdns_33/pdns.conf.erb"),
                 notify => Exec[[reload]],
<-- snipped -->

You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/a23685a3-4f2b-4abb-a7e0-6a20c7eb0323%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
grouppuppet-users @
postedJan 2, '14 at 2:28p
activeJan 4, '14 at 1:24p



site design / logo © 2022 Grokbase