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

icinga_plugins role is not compatible to debian #13

Closed
vmpr opened this issue Jan 10, 2022 · 3 comments · Fixed by #16
Closed

icinga_plugins role is not compatible to debian #13

vmpr opened this issue Jan 10, 2022 · 3 comments · Fixed by #16

Comments

@vmpr
Copy link

vmpr commented Jan 10, 2022

I just tested the next role from the collection and also that one is not compatible with Debian :(

  • at the moment the role installs nothing on debian10 because of this when condition:
- name: install icinga and nagios plugins
  ansible.builtin.package:
    name: "{{ item }}"
    state: present
  loop: "{{ icinga_install_plugins }}"
  when:
    - icinga_install_plugins is defined
    - icinga_install_plugins | length > 0
    - ansible_facts.distribution != "RedHat" and ansible_facts.distribution_major_version|int is version('8', '<')

there will be also the problem that package names between RedHat and Debian are different, like:

  • monitoring-plugins in Debian
  • nagios-plugins-all in RedHat

cheers

@beechesII
Copy link
Contributor

Hi @vmpr ,
icinga_install_plugins is not defined by default. You should be able to install monitoring-plugins on debian, if you define the variable.

icinga_install_plugins: 
  - monitoring-plugins

@vmpr
Copy link
Author

vmpr commented Jan 18, 2022

Hi @beechesII thanks for your answer, like I said it will never try to install plugins because of the when conditions with not rhel and major version is smaller than 8 because its debian10 :)

I also had to change that one:

- name: set plugins ownership
  ansible.builtin.file:
    path: "{{ item.path }}"
    owner: "{{ icinga2_user[ansible_os_family] }}"
    group: "{{ icinga2_group[ansible_os_family] }}"
    mode: 0755
  loop: "{{ files_in_plugins_dir.files }}"
  loop_control:
    label: "{{ item.path }}"
  tags:
    - set_ownership

plus set these variables:

  • plugins_basedir is different in debian than in rhel
  • users are different in debian than in rhel
    # this paths needs to go into the plugins role
    icinga2_plugins_basedir: /usr/lib/nagios
    icinga2_plugins_pluginsdir: "{{ icinga2_plugins_basedir }}/plugins"
    # icinga user/group for plugins role, they need to fix that
    # i fixed the role code to make it possible :(
    icinga2_user:
      Debian: nagios
      RedHat: icinga
    icinga2_group:
      Debian: nagios
      RedHat: icinga

cheers

@beechesII
Copy link
Contributor

Hi @vmpr ,

I created a branch fix_role_icinga_plugins_for_debian based on your code snippets in this issue. I tested both roles on my debian 11 virtual machine with the following playbook:

---
- hosts: localhost
  gather_facts: true
  collections:
    - t_systems_mms.ansible_collection_icinga
  vars:
    icinga_agent_endpoints:
      - name: "icinga2-master1.localdomain"
        host: "192.154.44.101"
      - name: "icinga2-satellite1.localdomain"
        host: "192.154.44.107"
    icinga_agent_zones:
      - name: "master"
        endpoints:
          - "icinga2-master1.localdomain"
      - name: "satellite"
        endpoints:
          - "icinga2-satellite1.localdomain"
        parent: "master"
  roles:
    - icinga_agent

- hosts: localhost
  collections:
    - t_systems_mms.ansible_collection_icinga
  vars:
    icinga_install_plugins:
      - monitoring-plugins
  roles:
    - icinga_plugins

Could you please checkout changes from branch fix_role_icinga_plugins_for_debian for debian 10?

Thx for reporting this issue :)

Have a nice day.

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

Successfully merging a pull request may close this issue.

2 participants