Now that I am starting to move from a primarily Hiera/YAML data backend to
using Foreman smart parameters, I am encountering an issue that I'd like to
see if anyone has dealt with. In Hiera, I use RI Pienaar's module_data
module so that I can build a data structure in every module, this allows me
to completely remove the kludgy class::params class method of setting
default variables with logic. This also makes the module a self-contained
object with the data and sane defaults, with hierarchy and logic, as a
Forge module and publish it. Moving to Foreman, I am looking at finding a
smart way to do the two use cases this addresses:
- Export my Foreman parameters, with matchers and overrides, as a standard
text format to be included with the module. This can be JSON, XML, SQL,
whatever, as long as it is text, and can be imported safely by Foreman
along with the class to pre-populate the parameters.
- Import a brand-new unknown class to the environment, and have all the
data and sane defaults imported, with conditionals, as Foreman parameters.
This should import the file in Step 1, otherwise the old-style import
matching can be used.
If anyone has worked on anything like this, I'd like to see it. I am a
terrible Ruby programmer, so I am not ready to start building plugins
myself to address this, but I am more than willing to help develop and test
something to help address this issue. At minimum, I'm interested in hearing
how other people have handled this issue.