I'd like to announce the availability of hiera-subnet, a new backend i've put together for looking up hiera facts from puppet by using the subnet location of the machine.
This means that, for instance you may have a fact as one thing for all machines (similar to common.yaml), something else for a /8 network, and something else for a /24 inside that - right down to node specific fact via a /32.
To use, you'll need to put the subnet_backend.rb file into one of your module's /lib/hiera/backend directory (you can make it if it dosen't exist), and ensure plugin-sync is on in puppet.conf.
You can then use a second in hiera.yaml which looks like:
:backends:
- subnet
:subnet:
:datadir: /some/folder/somewhere
Ensure puppet can read /some/folder/somewhere, and you're good to go !
Files in the dir you nominate need to fit the form 0_0_0_0-0.yaml, 192_168_1_0-24.yaml etc. The network is underscored and the netmask is a hyphenated (because '/' isn't valid in filenames, and '.' is confusing). 0_0_0_0-0.yaml is used as the common.yaml equivilent.