On 07/02/2010 12:11 PM, Druwerd wrote:
Is there a better way to set the permissions on the cfg files
generated by the nagios_service type?
I want each nagios service check to have it's own file, but don't want
to write it out each time. Is there a way to set default permissions
for the nagios_service cfg files?

     # Monitor ntp services
     @@nagios_service{ "nrpe_ntp":
         target                          =>  "/etc/nagios/conf.d/
services/${fqdn}_nrpe_ntp.cfg"
         check_command         =>  "check_nrpe!check_ntp_time"
     }

     # Change the permissions of the nagios ntp check file
         @@file{ "/etc/nagios/conf.d/services/${fqdn}_nrpe_ntp.cfg":
             owner   =>  root,
             group   =>  root,
             mode   =>  444,
             require =>  Nagios_service["nrpe_ntp"],
             tag       =>  "nagios",
         }


You use a combination of overrides and an exec that fixes the permissions.

Nagios_service {
    notify => Exec["fix_nagios_perms"];
}

exec {
    "fix_nagios_perms":
        command         => "/bin/chmod -R 755 /etc/nagios3",
        notify          => Service["nagios"],
        refreshonly     => "true";

service {
    "nagios":
        ensure => "running";
}

--
Joe McDonagh
AIM: YoosingYoonickz
IRC: joe-mac on freenode
"When the going gets weird, the weird turn pro."

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

Reply via email to