Hi,
I'm using Puppet for the first time, and for my tests, I'm recreating our
Nagios setup into a Puppet modules. It works at 95%, but I do have a
problem: my module include files but I also need to modify a couple of
Nagios configuration files that comes with the Nagios RPM package. Example:
commandes.pp:
class nagios::commandes {
nagios_command { 'process-service-perfdata':
command_name => 'process-service-perfdata',
ensure => present,
command_line => '/usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl',
target => '/etc/nagios/objects/commands.cfg',
}
}
init.pp:
class nagios {
include nagios::commandes
package { 'nagios':
ensure => present,
}
package { 'nagios-plugins-all':
ensure => present,
}
package { 'nrpe':
ensure => present,
}
service { 'nagios':
ensure => running,
hasstatus => true,
hasrestart => true,
enable => true,
require => Package["nagios"],
}
}
It works fine when Nagios is already installed, but if not, the include of
the class in init.pp is done before the package is installed so it fails.
Error: Puppet::Util::FileType::FileTypeFlat could not write
/etc/nagios/objects/commands.cfg: No such file or directory -
/etc/nagios/objects/commands.cfg
Error:
/Stage[main]/Nagios::Commandes/Nagios_command[process-service-perfdata]:
Could not evaluate: Puppet::Util::FileType::FileTypeFlat could not write
/etc/nagios/objects/commands.cfg: No such file or directory -
/etc/nagios/objects/commands.cfg
If there a way to include the class only if the package is installed?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/b48d1506-9926-4c89-8879-18451079e7cc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.