Closed rlaurika closed 8 years ago
I think it would be quite nice to just define https://github.com/CSC-IT-Center-for-Science/ansible-role-nrpe as a dependency in the meta file. Then it will get executed before this nrpe-plugins role. I haven't done extensive testing with those dependencies but it works with 1.9.4 and I'd probably want to define it like in here: https://github.com/CSC-IT-Center-for-Science/ansible-role-slurm/blob/master/meta/main.yml
Setting the dependency is fine, but the issue I was trying to describe still remains. It has to do with how the two roles work together. Even if you use both, you can still end up in a situation where the checks are not properly updated, because this role does not have a handler for the nrpe daemon.
Consider this scenario: 1) Everything is initially configured correctly with monitoring using the main nrpe role and nrpe-plugins 2) You add an extra check using nrpe-plugins, but make no other changes to your code
What you would expect to happen is that the new check would be usable immediately after the Ansible run, but it won't be. You have to restart the nrpe daemon for the changes to take place, because the change made only in the config of nrpe-plugins won't be picked up by the handler in the main nrpe role.
The way the roles are made right now it's not enough to only install an extra plugin in nrpe-plugins This role just installs the check via get_url, pip or copy. One still has to add it to the nagios_plugins list for the nrpe role to configure nrpe to use it (and configuring that will restart nrpe/opsview).
The nrpe service is not restarted when a check is updated. But that seems to not needed.
I don't think we need to change anything here.
Maybe documentation could be updated to be clearer on this? https://github.com/CSC-IT-Center-for-Science/ansible-role-nrpe-plugins/blob/master/README.md
If I deploy new checks using this role, those new checks won't be available through the nrpe daemon initially because this role doesn't handle refreshing that daemon. I could also call this role before calling the main nrpe role, but then this role would fail if the correct directories are not yet in place, right?
Things do work correctly on the first go if you first call the nrpe role and then this role, as then the handler for restarting nrpe will be run after this role has deployed plugins. But when you make subsequent changes that only affect plugins deployed using this role then this issue happens.
I'm not sure what the best way to handle this would be. The easiest way would be to add a handler in this role as well for refreshing nrpe, but then you would have that handler in two places. Another option might be to combine the two roles?