On Fri, Jul 29, 2016 at 5:53 PM, Luke Bigum <luke.bi...@lmax.com> wrote:
> Can someone explain this to me? I thought I'd be able to change the title > of a nagios_host resource but leave name_var the same to effectively write > two nagios_host files to disk with the same content, but instead I'm > triggering an error in the resouce alias code. I didn't realise changing > namevar was using resource aliases under the hood? > > Short answer here is, you can't - at least without modifying the nagios_host type. Puppet defines uniqueness by the value of the namevar, in the absence of the namevar being defined, it's value is set from the resource title. Therefore you can never have two resources with the same namevar. The theoretical solution to your issue would be to make a composite namevar combining both the target and the host_name - I did an extensive write up of all this recently; http://www.craigdunn.org/2016/07/composite-namevars-in-puppet/ One slightly hackish approach would be to write your own custom_nagios_host type using composite namevars and write a small provider that doesn't do much else than inherit off the nagios_host default provider. > -- > Luke Bigum > Senior Systems Engineer > > [ massive snip ] Polite request; Whilst we are all delighted in the number of awards your employer has received, if you must have a 58 line signature on emails sent to public forums, could you please format it correctly with "-- " (dash dash space) so compliant mail programs can handle it properly. Thanks ;) -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CACxdKhFEHysLyn1agnpDxK2x7_U0sdbZqzrARkAMFmDWfL3VsA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.