update: monitoring conf & git dep

This commit is contained in:
2022-12-28 19:17:58 +01:00
parent 58f06c4b72
commit ecc1e0d4ad
2 changed files with 20 additions and 2 deletions

View File

@@ -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 - name: Install Dependencies
apt: apt:
name: name:
- python3-nagiosplugin - python3-nagiosplugin
- nagios-plugins-contrib - nagios-plugins-contrib
- git
state: present state: present
- name: Clone Passive Monitoring - name: Clone Passive Monitoring
@@ -28,7 +36,15 @@
register: postgresql_installed register: postgresql_installed
ignore_errors: true ignore_errors: true
changed_when: False changed_when: False
check_mode: no
- name: Set has_postgres variable - name: Set has_postgres variable
set_fact: set_fact:
has_postgres: "{{ postgresql_installed.rc == 0 }}" has_postgres: "{{ postgresql_installed.rc == 0 }}"
- name: Template Remote Monitoring Config
template:
src: monitoring.conf
dest: /etc/monitoring.conf
owner: root
mode: 644

View File

@@ -4,8 +4,10 @@ nobody systemd /etc/monitoring-tools/pynagsystemd.py
{% if has_postgres %} {% if has_postgres %}
nobody load /usr/lib/nagios/plugins/check_psql nobody load /usr/lib/nagios/plugins/check_psql
{% endif } {% endif %}
{% if checks %}
{% for entry in checks %} {% for entry in checks %}
{{ entry["user"] }} {{ entry["name"] }} {{ entry["command"] }} {{ entry["user"] }} {{ entry["name"] }} {{ entry["cmd"] }}
{% endfor %} {% endfor %}
{% endif %}