Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource-like declaration of icinga2::feature::api apparently not possible #744

Closed
christian-2 opened this issue Nov 13, 2023 · 2 comments
Closed

Comments

@christian-2
Copy link

I have tried defining a Puppet class that includes resource-like declarations of classes ::icinga2 and ::icinga2::feature::api as well as resource type icinga2::object::zone almost literally like in the example you provide in section Agent of the documentation. Such a class would be convenient, because it could e.g. assign constant attribute values of for ::icinga2::feature::api that apply in my case (e.g. $accept_config = true) and calculate others (e.g. $bind_host = $ip).

However this fails: Puppet complains about a duplicate declaration of Icinga2::Feature::Api. I suspect this is because the definition of ::icinga2 states include prefix($features, 'icinga2::feature::'), i.e. it also declares ::icinga2::feature::api. Reversing the order between ::icinga2 and ::icinga2::feature::api also fails and is presumably prohibited by design: "you must include the icinga2 base class before using any icinga2 feature class".

I conclude from this that ::icinga2::feture::api must be declared include-like and that a resource-like declaration as in the provided example won't actually work. (This would be somewhat of a pity because I would have to provide all arguments verbatim in Hiera instead of having, say, three different classes that could serve for the master, for satellites, and agents more concisely. For many hosts that difference seems of concern.) Could you please clarify and perhaps change the manifest in the documentation, if applicable.

@lbetz
Copy link
Member

lbetz commented Nov 13, 2023

Hi Christian,

the example https://github.com/icinga/puppet-icinga2#agent works like describe. You don't have to put the api feature to the features parameter (by default a list of mainlog, checker and notification).

It's also used so in https://github.com/Icinga/puppet-icinga/blob/main/manifests/init.pp, maybe classes you are looking for?

Bye
Lennart

@christian-2
Copy link
Author

@lbetz Thanks for your quick response! Yes, that makes good sense. I've now removed 'api' from features => ['api','checker','mainlog'] in my declaration of ::icinga2 and this makes a subsequent resource-like declaration of ::icinga2::feature::api possible exactly as described in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants