[puppet] puppet module improvements

Benedikt Trefzer benedikt.trefzer at cirrax.com
Tue May 30 12:29:41 UTC 2023


Hi all

I use the openstack puppet modules to deploy openstack. I'd like to 
suggest some improvements to the modules and like to know what the 
community thinks about:

1.) use proper types for parameters
Parameter validation is done with 'validate_legacy...' instead of 
defining the class/resource parameter with a proper type all over the code.
I cannot imaging of any advantage not using proper type definitions.
Instead using typed parameters would be more efficient an code 
readability would increase.

2.) params.pp
This is the legacy way to define parameter defaults for different OS's.
In the modern puppet world a module specific hiera structure is used, 
which eliminates the need of params.pp class (with inheritance and include).
The usage of hiera improves readability and flexibility (every parameter
can be overwritten on request, eg. change of packages names etc.)
This also eliminate the restriction that the modules can only be used by 
certain OS'es (osfamily 'RedHat' or 'Debian').

3.) Eliminate "if OS=='bla' {" statements in code
These statements make the code very inflexible. It cannot be overruled 
if necessary (eg. if I use custom packages to install and do not need 
the code provided in the if statement).
Instead a parameter should be used with a default provided in hiera.


Since there is lot of code to change I do not expect this to be done in 
a single commit (per module) but in steps probably in more than one 
release cycle. But defining this as best practice for openstack puppet 
modules and start using above in new commits would bring the code forward.

Finally: These are suggestions open for discussion. In no way I like to 
critic the current state of the puppet modules (which is quite good, but 
a bit legacy) or the people working on the modules. This is just a 
feedback/suggestion from an operator using the modules on a daily basis.

Regards

Benedikt Trefzer



More information about the openstack-discuss mailing list