Hi folks,

I'm grappling with a data structure that I want to model as a hash in Puppet and ultimately mash it down to a string for use in a config file.

I'm writing out a config for Nagios BPI and there is one complex parameter "members" which is described like this in the documentation:

# members - a comma delineated list of members.
#    For services, format is: <hostname>;<servicename>;<opt>,
#    For groups, format is:  $<groupID>;<opt>,
#        the <opt> is an '&' or '|' character.
# '&' option after host:servicename means service is part of a CLUSTER # For clusters, 'critical' is only reached when ALL services in a cluster are NOT 'Ok' # '|' option after host:servicename means it is an essential service for the group, # example: a 'critical' service with an '|' option will cause a 'critical' state
#       for the entire group.

When configured, the parameter looks like this:

members=radius-local01.example.com;RADIUS;&, radius-local02.example.com;RADIUS;&, radius-local03.example.com;RADIUS;&,

I want to model this in a hash like this:

$members = {
  'radius-local01.example.com' => {
    service => 'RADIUS',
    opt => '&',
  },
  'radius-local02.example.com' => {
    service => 'RADIUS',
    opt => '&',
  },
  'radius-local03.example.com' => {
    service => 'RADIUS',
    opt => '&',
  },
}

Is my design sensible, and how can I manipulate this data to generate a string in the config file as above? I'm using Puppet Enterprise 2016.5 but I only upgraded from Puppet 3.8 a couple of weeks ago, so I'm still new to the Puppet 4 syntax.

Thanks,
Jonathan

--
Jonathan Gazeley
Senior Systems Administrator
IT Services
University of Bristol

--
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/7794f367-7028-0bb5-422c-2d46bc133545%40bristol.ac.uk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to