FAQ
Hello Pros and users of Puppet.

I have two problems with the following modul setup:
My first problem that i tried every combination of
require,notify,subscribe for the mail sending exec but it runs every
single time when i run the module no matter if the files changed or
not.

Second problem that puppet reports that snmpd was refreshed by two
resource and restarted but actually it doesnt happen.
remote: info: /etc/default/snmpd: Scheduling refresh of Service[snmpd]
remote: notice: /Stage[main]/Monitoring/Service[snmpd]/ensure: ensure
changed 'stopped' to 'running'
remote: notice: /Stage[main]/Monitoring/Service[snmpd]: Triggered
'refresh' from 2 events

Any help would be much appreciated regarding how to restart snmpd on
Ubuntu LTS 10.04 repository install and how to make exec to run only
if the created file changes.

file{ '/etc/default/snmpd':
ensure => present,
source =>
"puppet:///modules/${module_name}/snmpd",
notify => Service['snmpd'],
require => [ Package['snmp'],
Package['snmpd'] ];

'/etc/snmp/snmpd.conf':
ensure => present,
source =>
"puppet:///modules/${module_name}/snmpd.conf",
notify => Service['snmpd'],
require => [ Package['snmp'],
Package['snmpd'] ];

'/etc/nagios/nrpe.cfg':
ensure => present,
source =>
"puppet:///modules/${module_name}/nrpe.cfg",
notify => Service['nagios-nrpe-server'],
require => Package['nagios-nrpe-server'];

'/etc/nagios/nrpe.d/nrpe-disk.cfg':
ensure => present,
source =>
"puppet:///modules/${module_name}/nrpe-disk.cfg",
notify => Service['nagios-nrpe-server'],
require => Package['nagios-nrpe-server'];

"/root/${hostname}.cfg":
ensure => present,
content =>
template("${module_name}/nagioshost.erb"),
notify => Exec["/usr/bin/mail -s
${hostname}-nagios-host-config -a /root/${hostname}.cfg
seewebmaster@smydomain.com"],
}

exec{ "/usr/bin/mail -s ${hostname}-nagios-host-config -a
/root/${hostname}.cfg seewebmaster@mydomain.com":
require => File["/root/${hostname}.cfg"];
}

service{'snmpd':
ensure => running,
subscribe => [
File['/etc/default/snmpd'], File['/etc/snmp/snmpd.conf'] ];

'nagios-nrpe-server':
ensure => running,
subscribe => [
File['/etc/nagios/nrpe.cfg'], File['/etc/nagios/nrpe.d/nrpe-disk.cfg']
],
}

Thank you
Peter

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Peter Horvath at Apr 25, 2012 at 11:57 am
    If anybody interested the simple solution was to add refreshonly =>
    true to the exec.
    the snmp restart instead of a proper service resource type has been
    replaced with an Exec
    '/usr/sbin/service snmpd restart':
    subscribe => [ File['/etc/default/
    snmpd'], File['/etc/snmp/snmpd.conf'] ],
    refreshonly => true;

    On Apr 25, 11:04 am, Peter Horvath wrote:
    Hello Pros and users of Puppet.

    I have two problems with the following modul setup:
    My first problem that i tried every combination of
    require,notify,subscribe for the mail sending exec but it runs every
    single time when i run the module no matter if the files changed or
    not.

    Second problem that puppet reports that snmpd was refreshed by two
    resource and restarted but actually it doesnt happen.
    remote: info: /etc/default/snmpd: Scheduling refresh of Service[snmpd]
    remote: notice: /Stage[main]/Monitoring/Service[snmpd]/ensure: ensure
    changed 'stopped' to 'running'
    remote: notice: /Stage[main]/Monitoring/Service[snmpd]: Triggered
    'refresh' from 2 events

    Any help would be much appreciated regarding how to restart snmpd on
    Ubuntu LTS 10.04 repository install and how to make exec to run only
    if the created file changes.

    file{   '/etc/default/snmpd':
    ensure          => present,
    source          =>
    "puppet:///modules/${module_name}/snmpd",
    notify          => Service['snmpd'],
    require         => [ Package['snmp'],
    Package['snmpd'] ];

    '/etc/snmp/snmpd.conf':
    ensure          => present,
    source          =>
    "puppet:///modules/${module_name}/snmpd.conf",
    notify          => Service['snmpd'],
    require         => [ Package['snmp'],
    Package['snmpd'] ];

    '/etc/nagios/nrpe.cfg':
    ensure          => present,
    source          =>
    "puppet:///modules/${module_name}/nrpe.cfg",
    notify          => Service['nagios-nrpe-server'],
    require         => Package['nagios-nrpe-server'];

    '/etc/nagios/nrpe.d/nrpe-disk.cfg':
    ensure          => present,
    source          =>
    "puppet:///modules/${module_name}/nrpe-disk.cfg",
    notify          => Service['nagios-nrpe-server'],
    require         => Package['nagios-nrpe-server'];

    "/root/${hostname}.cfg":
    ensure          => present,
    content         =>
    template("${module_name}/nagioshost.erb"),
    notify          => Exec["/usr/bin/mail -s
    ${hostname}-nagios-host-config -a /root/${hostname}.cfg
    seewebmas...@smydomain.com"],
    }

    exec{   "/usr/bin/mail -s ${hostname}-nagios-host-config -a
    /root/${hostname}.cfg seewebmas...@mydomain.com":
    require         => File["/root/${hostname}.cfg"];
    }

    service{'snmpd':
    ensure          => running,
    subscribe       => [
    File['/etc/default/snmpd'], File['/etc/snmp/snmpd.conf'] ];

    'nagios-nrpe-server':
    ensure          => running,
    subscribe       => [
    File['/etc/nagios/nrpe.cfg'], File['/etc/nagios/nrpe.d/nrpe-disk.cfg']
    ],
    }

    Thank you
    Peter
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Jcbollinger at Apr 25, 2012 at 2:07 pm

    On Apr 25, 6:57 am, Peter Horvath wrote:
    If anybody interested the simple solution was to add refreshonly =>
    true to the exec.
    the snmp restart instead of a proper service resource type has been
    replaced with an Exec
    '/usr/sbin/service snmpd restart':
    subscribe       => [ File['/etc/default/
    snmpd'], File['/etc/snmp/snmpd.conf'] ],
    refreshonly     => true;

    So, is there a reason to prefer that to

    service { 'snmpd':
    ensure => running,
    enable => true,
    hasstatus => true,
    hasrestart => false,
    restart => '/usr/sbin/service snmpd restart',
    subscribe => [ File['/etc/default/snmpd'], File['/etc/snmp/
    snmpd.conf'] ],
    }

    ?


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Peter Horvath at Apr 25, 2012 at 2:15 pm
    I didnt know this way of declaration :) thank you works like a charm
    On 25 April 2012 15:07, jcbollinger wrote:

    On Apr 25, 6:57 am, Peter Horvath wrote:
    If anybody interested the simple solution was to add refreshonly =>
    true to the exec.
    the snmp restart instead of a proper service resource type has been
    replaced with an Exec
    '/usr/sbin/service snmpd restart':
    subscribe       => [ File['/etc/default/
    snmpd'], File['/etc/snmp/snmpd.conf'] ],
    refreshonly     => true;

    So, is there a reason to prefer that to

    service { 'snmpd':
    ensure => running,
    enable => true,
    hasstatus => true,
    hasrestart => false,
    restart => '/usr/sbin/service snmpd restart',
    subscribe =>  [ File['/etc/default/snmpd'], File['/etc/snmp/
    snmpd.conf'] ],
    }

    ?


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedApr 25, '12 at 10:04a
activeApr 25, '12 at 2:15p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase