-
Notifications
You must be signed in to change notification settings - Fork 22
Generic feature handling #12
Comments
I don't see how the current I'd prefer the generic templates and symlinks option as that, as you point out, fits in with how Icinga2 behaves. Generally I prefer to use Ansible to maintain standard approaches, rather than introducing new approaches as it's more likely to be understood by future maintainers/sysadmins. |
Hey, @RossBarnie I agree with you on the generic template. Before I start working on those features I want to make a point clear how I think a generic template look like. As you might have seen my templates which are, i would say, generic - we need to use a hash variable for that. Therefore we iterate through the values an generate everything we need. But in this case I struggle with the Ansible variable precedence. If we define a standard hash as default for the feature:
As I just want to change one value of the feature, let's say the host parameter. We need to overwrite the whole hash on a higher level like group_vars. If we overwrite the variable like this:
Results...
... into a hash which has only one value left. So we need to encourage users to overwrite the whole hash with defaults and their own values. Like so:
This would be a generic template for every feature we are using, would you agree on that topic? Or do you suggest by documenting all parameters, that we define every feature with all parameter defaults and use single parameters for every feature-parameter?
m'kay |
Ok, haven't seen that trick before :) Seems I won't need to worry about the MERGE_BEHAVOUR anymore. |
I think that by creating the generic template we'd be saving ourselves from having to keep our templates up to date with Icinga2 (admittedly we'd be passing that responsibility to the user but that's fine in my opinion). And yes the i2_feature hash is much better to me than the individual variables. I'm not even sure how we'd handle it that way without having to specify every possible feature and parameter. I haven't seen anyone else use that hash trick but it's worked for me so far! 😄 |
I fund it useful to construct endpoints:
It took me quite a while to figure out how to do this. Edit: added more context. |
@RossBarnie I did some tests and it's charming but only with simple hashes. Something like this:
which fits for most features. When we take a look at the Ido-Mysql feature we notice that the cleanup settings are also defined as hash.
So I would assume that we should provide the options on that feature in the same way than the others:
EDIT: RTM Example:
|
A general helper that can enable and disable features and change configuration for a feature.
Following options come to my mind:
icinga2
does.No specific feature options are set here.
A reload/restart of Icinga is triggered if a feature is enabled/disabled or the configuration changes.
Every specific feature allows the configuration of its settings. Some features may have extended functionality, such as importing data schemas.
Example implementation with templates: https://github.com/mkayontour/icinga2-ansible/tree/master/roles/icinga2-feature-handler
Another example implementation with templates: https://github.com/chrnie/ansible-role-icinga2
Feedback is very welcome, I don't know what's the best "ansible way" here.
The text was updated successfully, but these errors were encountered: