diff --git a/library/roles/nagios/defaults/main.yml b/library/roles/nagios/defaults/main.yml index 3d9a4d7b..a222d5ce 100644 --- a/library/roles/nagios/defaults/main.yml +++ b/library/roles/nagios/defaults/main.yml @@ -53,6 +53,8 @@ nagios_psql_db_size_c: 170000000 nagios_psql_wal_files_w: 20 nagios_psql_wal_files_c: 40 +#nagios_additional_checkdisk_options: '-i "/path/.*/to/dir" -A /foo' + nrpe_command_timeout: 420 nrpe_include_dir: /etc/nagios/nrpe.d/ diff --git a/library/roles/nagios/tasks/dell-omsa.yml b/library/roles/nagios/tasks/dell-omsa.yml index d7b2fcf3..fd52b37e 100644 --- a/library/roles/nagios/tasks/dell-omsa.yml +++ b/library/roles/nagios/tasks/dell-omsa.yml @@ -33,30 +33,23 @@ tags: [ 'dell', 'nagios' ] - name: Install the Dell OMSA packages dependencies - apt: pkg={{ item }} state=present force=yes update_cache=yes cache_valid_time=1800 - with_items: '{{ nagios_dell_omsa_deps }}' + apt: pkg={{ nagios_dell_omsa_deps }} state=present force=yes update_cache=yes cache_valid_time=1800 tags: [ 'dell', 'nagios' ] - name: Install other Dell OMSA packages dependencies - apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=1800 - with_items: - - python-requests + apt: pkg=python-requests state=present update_cache=yes cache_valid_time=1800 register: requests_pkg ignore_errors: True tags: [ 'dell', 'nagios' ] - name: Install the python-pip package if requests is not available as a package - apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=1800 - with_items: - - python-pip - when: requests_pkg|failed + apt: pkg=python-pip state=present update_cache=yes cache_valid_time=1800 + when: requests_pkg is failed tags: [ 'dell', 'nagios' ] - name: Install the python-requests package via pip if it s not available as package - pip: name={{ item }} state=latest use_mirrors=no - with_items: - - requests - when: requests_pkg|failed + pip: name=requests state=latest use_mirrors=no + when: requests_pkg is failed tags: [ 'dell', 'nagios' ] - name: Get the old libssl0.9.8_9.9.8 needed by del Dell OMSA utilities on debian 7 @@ -71,20 +64,16 @@ tags: [ 'dell', 'nagios' ] - name: Install the main Dell OMSA package - apt: pkg={{ item }} state={{ nagios_dell_omsa_pkg_state }} force=yes update_cache=yes cache_valid_time=1800 - with_items: - - syscfg + apt: pkg=syscfg state={{ nagios_dell_omsa_pkg_state }} force=yes update_cache=yes cache_valid_time=1800 tags: [ 'dell', 'nagios' ] - name: Install the Dell OMSA packages - apt: pkg={{ item }} state={{ nagios_dell_omsa_pkg_state }} force=yes update_cache=yes cache_valid_time=1800 - with_items: '{{ nagios_dell_omsa_pkgs }}' + apt: pkg={{ nagios_dell_omsa_pkgs }} state={{ nagios_dell_omsa_pkg_state }} force=yes update_cache=yes cache_valid_time=1800 notify: Start Dell OMSA tags: [ 'dell', 'nagios' ] - name: Install some standalone plugins - copy: src={{ item }} dest={{ nagios_local_plugdir }}/{{ item }} owner=root group=nagios mode=0750 - with_items: '{{ nagios_dell_standalone_checks }}' + copy: src={{ nagios_dell_standalone_checks }} dest={{ nagios_local_plugdir }}/{{ item }} owner=root group=nagios mode=0750 tags: [ 'dell', 'nagios' ] - name: Install a cron job that removes the leaked semaphores created by the nagios check of Dell hardware status diff --git a/library/roles/nagios/tasks/hardware-checks.yml b/library/roles/nagios/tasks/hardware-checks.yml index 7182657e..54e15342 100644 --- a/library/roles/nagios/tasks/hardware-checks.yml +++ b/library/roles/nagios/tasks/hardware-checks.yml @@ -9,9 +9,7 @@ - nagios - name: Install some packages needed by the hardware checks - apt: pkg={{ item }} state=present - with_items: - - smartmontools + apt: pkg=smartmontools state=present tags: - nagios-hw - nagios diff --git a/library/roles/nagios/tasks/nagios.yml b/library/roles/nagios/tasks/nagios.yml index 448616e6..ca1f7d80 100644 --- a/library/roles/nagios/tasks/nagios.yml +++ b/library/roles/nagios/tasks/nagios.yml @@ -1,12 +1,10 @@ --- - name: Install the nagios packages - apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=1800 - with_items: '{{ nagios_plugins_base_pkgs }}' + apt: pkg={{ nagios_plugins_base_pkgs }} state=present update_cache=yes cache_valid_time=1800 tags: nagios - name: Additional nagios plugins when available - apt: pkg={{ item }} state=present update_cache=yes cache_valid_time=1800 - with_items: '{{ nagios_plugins_contrib }}' + apt: pkg={{ nagios_plugins_contrib }} state=present update_cache=yes cache_valid_time=1800 tags: [ 'nagios', 'nagios_plug_contrib' ] - name: Create the directory where our local plugins are installed diff --git a/library/roles/nagios/tasks/nsca.yml b/library/roles/nagios/tasks/nsca.yml index 96d09be8..f2e4561e 100644 --- a/library/roles/nagios/tasks/nsca.yml +++ b/library/roles/nagios/tasks/nsca.yml @@ -1,19 +1,8 @@ --- - name: Configure the nsca client template: src=send_nsca.j2 dest=/etc/send_nsca.cfg owner=root group=root mode=400 - tags: - - nsca + tags: nsca -- apt: pkg={{ item }} state=present - with_items: - - nsca-client - when: '(({{ is_not_ubuntu_less_than_precise }}) == True) or (({{ is_debian7 }}) == True)' - tags: - - nsca +- apt: pkg=nsca-client state=present + tags: nsca -- apt: pkg={{ item }} state=present - with_items: - - nsca - when: "(({{ is_not_debian_less_than_6 }}) == True) and (({{ is_ubuntu_less_than_precise }}) == True)" - tags: - - nsca diff --git a/library/roles/nagios/tasks/postgresql-nagios.yml b/library/roles/nagios/tasks/postgresql-nagios.yml index 91c5cb81..dc09aa8f 100644 --- a/library/roles/nagios/tasks/postgresql-nagios.yml +++ b/library/roles/nagios/tasks/postgresql-nagios.yml @@ -12,9 +12,7 @@ - nagios - name: Install the packages needed to check postgres via nagios - apt: pkg={{ item }} state=present - with_items: - - check-postgres + apt: pkg=check-postgres state=present tags: - nrpe - nagios diff --git a/library/roles/nagios/templates/common-nrpe.cfg.j2 b/library/roles/nagios/templates/common-nrpe.cfg.j2 index f8282eb7..5ff96c61 100644 --- a/library/roles/nagios/templates/common-nrpe.cfg.j2 +++ b/library/roles/nagios/templates/common-nrpe.cfg.j2 @@ -1,5 +1,5 @@ # -command[global_check_disk]={{ nagios_plugins_dir }}/check_disk -w {{ nagios_check_disk_w }}% -c {{ nagios_check_disk_c }}% -X tmpfs -X proc -X sysfs -X devpts -X dev -A -i /mnt/.* +command[global_check_disk]={{ nagios_plugins_dir }}/check_disk -w {{ nagios_check_disk_w }}% -c {{ nagios_check_disk_c }}% -X tmpfs -X proc -X sysfs -X devpts -X dev -A -i "/mnt/.*" {% if nagios_additional_checkdisk_options is defined %} {{ nagios_additional_checkdisk_options }} {% endif %} command[global_check_load]={{ nagios_plugins_dir }}/check_load {% if nagios_load_per_cpu %}-r{% endif %} -w {{ nagios_load_w }} -c {{ nagios_load_c }} {% if ansible_distribution_release == 'xenial' %}