From 895572236cf016c78cfb4b5fcdfea9bd6f5766bd Mon Sep 17 00:00:00 2001 From: David Galloway Date: Fri, 1 Oct 2021 12:11:32 -0400 Subject: [PATCH] common: Add nrpe support to zypper systems Signed-off-by: David Galloway --- roles/common/tasks/main.yml | 6 ++---- roles/common/tasks/nagios.yml | 13 ++++--------- roles/common/vars/dnf_systems.yml | 1 + roles/common/vars/zypper_systems.yml | 9 +++++++++ 4 files changed, 16 insertions(+), 13 deletions(-) create mode 120000 roles/common/vars/dnf_systems.yml create mode 100644 roles/common/vars/zypper_systems.yml diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index c03c3c6..9c4200f 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -41,11 +41,9 @@ - monitoring-scripts - nagios -# configure nagios (Except OpenSUSE and CentOS 9 Stream) +# configure nagios (Except CentOS 9 Stream) - import_tasks: nagios.yml - when: - - ansible_pkg_mgr != "zypper" - - not (ansible_distribution == "CentOS" and ansible_distribution_major_version == "9") + when: not (ansible_distribution == "CentOS" and ansible_distribution_major_version == "9") tags: - nagios diff --git a/roles/common/tasks/nagios.yml b/roles/common/tasks/nagios.yml index cc926bf..e162e9a 100644 --- a/roles/common/tasks/nagios.yml +++ b/roles/common/tasks/nagios.yml @@ -1,11 +1,6 @@ --- -- name: Include apt_system vars - include_vars: apt_systems.yml - when: ansible_pkg_mgr == "apt" - -- name: Include yum_systems vars - include_vars: yum_systems.yml - when: ansible_os_family == "RedHat" +- name: "Include {{ ansible_pkg_mgr }}_system vars" + include_vars: "{{ ansible_pkg_mgr }}_systems.yml" # Returns 0 if found and 1 if not found # Task fails if not found. Hence ignore_errors: true @@ -40,11 +35,11 @@ - ansible_os_family == "RedHat" - have_epel.rc == 0 -- name: Install nrpe package and dependencies (Ubuntu/Fedora) +- name: Install nrpe package and dependencies (non-RHEL/CentOS) package: name: "{{ nrpe_packages|list }}" state: latest - when: ansible_pkg_mgr == "apt" or ansible_distribution == "Fedora" + when: ansible_os_family != "RedHat" - name: Upload nagios sudoers.d for raid utilities. template: diff --git a/roles/common/vars/dnf_systems.yml b/roles/common/vars/dnf_systems.yml new file mode 120000 index 0000000..3eacc96 --- /dev/null +++ b/roles/common/vars/dnf_systems.yml @@ -0,0 +1 @@ +yum_systems.yml \ No newline at end of file diff --git a/roles/common/vars/zypper_systems.yml b/roles/common/vars/zypper_systems.yml new file mode 100644 index 0000000..c655e01 --- /dev/null +++ b/roles/common/vars/zypper_systems.yml @@ -0,0 +1,9 @@ +--- +nrpe_service_name: nrpe +nrpe_user: nrpe +nrpe_group: nrpe +nagios_plugins_directory: /usr/lib/nagios/plugins + +nrpe_packages: + - nrpe + - monitoring-plugins-nrpe -- 2.39.5