Hello, I'm new to puppet and puppet module writing and kindly request your help. My understanding of proper puppet module practices is still young.
Being tasked to write a puppet module for a utility that configures interfaces on a cumulus switch. there are 3 main types of interfaces - physical - bridge - bond Each of these 3 types of interfaces have their own set of parameters but are ultimately configured on the system in the same way. So I definitely want to reuse as much code as possible. So the thinking is to define the user interface something like this: cumulus_iface::interface { 'eth1' # physical int attributes } cumulus_iface::bridge { 'br0' # bridge int attributes } cumulus_iface::bond { 'bond0' # bond int attributes } My question is how to implement this, if this structure is okay. My thought is as follows, create a cumulus_iface custom type that has a 'ifaceattrs' parameter. this is where all the code can be reused across all interface types. This parameter accepts a hash. Provider will be 'ruby'. Then create 3 defined types, 'interface', 'bridge', 'bond' under the cumulus_iface module manifest directory structure, each providing their own specific set of parameters. These defined types will take their parameters and combine it into a single hash and input it to the 'ifaceattrs' parameter of the cumulus_iface custom type. For example: cumulus_iface::interface {'eth1' speed => 1000 ipv4 => '10.1.1.1/24' } would in turn be inputted into cumulus_iface custom type as cumulus_iface { 'eth1' ifaceattrs => { :speed => 1000, :ipv4 => '10.1.1.1/24' } } Can this work? Does this make sense? Thanks for your help! -- 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/6582e6a0-393c-433a-842a-88f46019d59d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.