Icinga/ansible-collection-icinga

Add flag to ignore unkown Icinga Web 2 modules

Donien opened this issue · 0 comments

Problem

I have a setup where I use one play in which I define my variable icingaweb2_modules.
I use this collection to install all modules it can actually manage (director for example).

After that I use another role which also looks at icingaweb2_modules and handles other modules like (in my case) grafana.

- name: Manage Icinga Web 2 Modules
  become: true
  hosts: host

  vars:
    icingaweb2_modules:
      director:
        enabled: true
        source: package
        ...
      grafana:
        package_name: "icinga-grafana"
        source: package
        other_option1:
        other_option2:
        ...

  roles:
    - icinga.icinga.icingaweb2
    - my.collection.icingaweb2_modules

With this setup icinga.icinga.icingaweb2 fails in "Configure modules" because it can't load <some_path>/modules/grafana.yml, for obvious reasons.

Proposed solution

Add a boolean variable like icingaweb2_ignore_unknown_modules. This Collection already has a variable holding the names of modules it can manage (icingaweb2_module_packages in roles/icingaweb2/vars/main.yml).

When evaluating whether a module is valid, we could compare against this variable somehow.