On Tue, 11 Feb 2014 06:53:42 -0800 (PST)
[email protected] wrote:

> I have a strange problem here. Most of my Nagios configuration are
> from file {} directive, but I also need to modify a couple of Nagios'
> default configuration. To do this, I use classes like this:
> 
> class nagios::gabarits { 
> 
>    nagios_host { 'linux-server': 
>      use => 'generic-host',
[...]
>      target => '/etc/nagios/objects/templates.cfg', 
>      ensure => present, 
>    }
> 
>  }
> 
> Problem is: it replace the content
> of /etc/nagios/objects/templates.cfg with the new host definition,
> but everything else in the file is gone! 

I think that's the expected behaviour.
The proper fix is to also declare the other nagios resources you want
to see in that file.

That's more or less how I solved it in my own module :
https://github.com/thias/puppet-nagios/blob/master/manifests/server.pp#L550
(feel free to copy/paste those lines!)

Though I did "move" all of the resources to their default files and
stopped using the objects/templates.cfg file.

HTH,
Matthias

-- 
            Matthias Saou                  ██          ██
                                             ██      ██
Web: http://matthias.saou.eu/              ██████████████
Mail/XMPP:  [email protected]             ████  ██████  ████
                                       ██████████████████████
GPG: 4096R/E755CC63                    ██  ██████████████  ██
     8D91 7E2E F048 9C9C 46AF          ██  ██          ██  ██
     21A9 7A51 7B82 E755 CC63                ████  ████

-- 
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/20140211171444.45ff5eac%40r2d2.marmotte.net.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to