From ecc1e0d4ad0279afc18db2ad0d9a678fed877fc5 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Wed, 28 Dec 2022 19:17:58 +0100 Subject: [PATCH] update: monitoring conf & git dep --- roles/monitoring-client/tasks/main.yaml | 16 ++++++++++++++++ .../monitoring-client/templates/monitoring.conf | 6 ++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/roles/monitoring-client/tasks/main.yaml b/roles/monitoring-client/tasks/main.yaml index d76f28d..91ab675 100644 --- a/roles/monitoring-client/tasks/main.yaml +++ b/roles/monitoring-client/tasks/main.yaml @@ -1,8 +1,16 @@ +- name: Update apt-get repo and cache + apt: + update_cache: yes + force_apt_get: yes + cache_valid_time: 3600 + changed_when: False + - name: Install Dependencies apt: name: - python3-nagiosplugin - nagios-plugins-contrib + - git state: present - name: Clone Passive Monitoring @@ -28,7 +36,15 @@ register: postgresql_installed ignore_errors: true changed_when: False + check_mode: no - name: Set has_postgres variable set_fact: has_postgres: "{{ postgresql_installed.rc == 0 }}" + +- name: Template Remote Monitoring Config + template: + src: monitoring.conf + dest: /etc/monitoring.conf + owner: root + mode: 644 diff --git a/roles/monitoring-client/templates/monitoring.conf b/roles/monitoring-client/templates/monitoring.conf index 7d720be..d0e0b98 100644 --- a/roles/monitoring-client/templates/monitoring.conf +++ b/roles/monitoring-client/templates/monitoring.conf @@ -4,8 +4,10 @@ nobody systemd /etc/monitoring-tools/pynagsystemd.py {% if has_postgres %} nobody load /usr/lib/nagios/plugins/check_psql -{% endif } +{% endif %} +{% if checks %} {% for entry in checks %} -{{ entry["user"] }} {{ entry["name"] }} {{ entry["command"] }} +{{ entry["user"] }} {{ entry["name"] }} {{ entry["cmd"] }} {% endfor %} +{% endif %}