commit 1c956c0ba232d28cc0e69ce555348d83a0b9d65c Author: Sheppy Date: Mon Dec 26 17:59:19 2022 +0100 inital: hypervisor ansible diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/files/COPYING_NSCA_NG b/files/COPYING_NSCA_NG new file mode 100644 index 0000000..7d29829 --- /dev/null +++ b/files/COPYING_NSCA_NG @@ -0,0 +1,63 @@ +https://github.com/weiss/nsca-ng/blob/master/COPYING + +Unless otherwise noted, all files distributed as part of NSCA-ng are covered +by the copyright and license statement below. Some files (outside the `src' +directory) are subject to different copyright and/or license terms, as +specified at the top of those files. However, all NSCA-ng code is believed +to be covered by terms which are at least as permissive as the following +license. + +| Copyright (c) 2013 Holger Weiss +| All rights reserved. +| +| Redistribution and use in source and binary forms, with or without +| modification, are permitted provided that the following conditions are +| met: +| +| 1. Redistributions of source code must retain the above copyright notice, +| this list of conditions and the following disclaimer. +| +| 2. Redistributions in binary form must reproduce the above copyright +| notice, this list of conditions and the following disclaimer in the +| documentation and/or other materials provided with the distribution. +| +| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +| IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +| PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +| CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +| PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +| PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +| LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +In addition to these copyright and license terms, binary redistributions may +be required to reproduce the following copyright notices, depending on which +source files are compiled. The above license statement applies to all of +them. + +If any files in the `lib/ev' directory are used during compilation: + +| Copyright (c) 2007-2018 Marc Alexander Lehmann +| Copyright (c) 2011 Emanuele Giaquinta + +If any files in the `lib/pidfile' directory are used during compilation: + +| Copyright (c) 2005 Pawel Jakub Dawidek +| Copyright (c) 2007 Dag-Erling Coidan Smoergrav + +If the file `lib/pidfile/flock.c' is used during compilation: + +| Copyright (c) 2001 The NetBSD Foundation, Inc. + +If any files in the `python' directory (except for `uthash.h') are used: + +| Copyright (c) 2014 Alexander Golovko + +If any files in the `perl' directory are used: + +| Copyright (c) 2015 Matthias Bethke + +Additional requirements may be imposed by external libraries. diff --git a/files/nsca-ng b/files/nsca-ng new file mode 100755 index 0000000..ac71992 Binary files /dev/null and b/files/nsca-ng differ diff --git a/files/send_nsca b/files/send_nsca new file mode 100755 index 0000000..3cd0004 Binary files /dev/null and b/files/send_nsca differ diff --git a/host_vars/irc.yaml b/host_vars/irc.yaml new file mode 100644 index 0000000..5d4d887 --- /dev/null +++ b/host_vars/irc.yaml @@ -0,0 +1,3 @@ +--- +checks : + - { user : sheppy, name : irc, cmd : ""} diff --git a/host_vars/mail.yaml b/host_vars/mail.yaml new file mode 100644 index 0000000..0e941d9 --- /dev/null +++ b/host_vars/mail.yaml @@ -0,0 +1,3 @@ +--- +checks : + - { user : nobody, name : mail_queue, cmd : ""} diff --git a/host_vars/ths.yaml b/host_vars/ths.yaml new file mode 100644 index 0000000..5d4d887 --- /dev/null +++ b/host_vars/ths.yaml @@ -0,0 +1,3 @@ +--- +checks : + - { user : sheppy, name : irc, cmd : ""} diff --git a/host_vars/vpn.yaml b/host_vars/vpn.yaml new file mode 100644 index 0000000..5076089 --- /dev/null +++ b/host_vars/vpn.yaml @@ -0,0 +1,4 @@ +--- +checks : + - { user : nobody, name : wireguard_rudi, cmd : ""} + - { user : nobody, name : wireguard_hase, cmd : ""} diff --git a/roles/monitoring-client/tasks/main.yaml b/roles/monitoring-client/tasks/main.yaml new file mode 100644 index 0000000..cda2ff2 --- /dev/null +++ b/roles/monitoring-client/tasks/main.yaml @@ -0,0 +1,28 @@ +- name: Install Dependencies + apt: + name: + - python3-nagiosplugin + - nagios-plugins-contrib + state: present + +- name: Clone Passive Monitoring + git: + repo: https://github.com/FAUSheppy/icinga-passive-checks-monitoring + dest: "/etc/monitoring/" + version: master + +- name: Clone Monitoring Tools + git: + repo: https://github.com/FAUSheppy/monitoring-tools + dest: "/etc/monitoring-tools/" + version: master + +- name: Check if PostgreSQL is installed + command: dpkg -s postgresql + register: postgresql_installed + ignore_errors: true + changed_when: False + +- name: Set has_postgres variable + set_fact: + has_postgres: "{{ postgresql_installed.rc == 0 }}" diff --git a/roles/monitoring-client/templates/monitoring.conf b/roles/monitoring-client/templates/monitoring.conf new file mode 100644 index 0000000..7d720be --- /dev/null +++ b/roles/monitoring-client/templates/monitoring.conf @@ -0,0 +1,11 @@ +nobody disk /usr/lib/nagios/plugins/check_disk +nobody load /usr/lib/nagios/plugins/check_log +nobody systemd /etc/monitoring-tools/pynagsystemd.py + +{% if has_postgres %} +nobody load /usr/lib/nagios/plugins/check_psql +{% endif } + +{% for entry in checks %} +{{ entry["user"] }} {{ entry["name"] }} {{ entry["command"] }} +{% endfor %} diff --git a/roles/monitoring-client/templates/send_nsca.cfg b/roles/monitoring-client/templates/send_nsca.cfg new file mode 100644 index 0000000..ff15746 --- /dev/null +++ b/roles/monitoring-client/templates/send_nsca.cfg @@ -0,0 +1,5 @@ +identity = {{ nsca_identity }} +password = {{ nsca_password }} +server = {{ nsca_server }} +port = {{ nsca_server_port }} +tls_ciphers = "PSK-AES256-CBC-SHA" diff --git a/roles/monitoring-master/tasks/main.yaml b/roles/monitoring-master/tasks/main.yaml new file mode 100644 index 0000000..d456dc3 --- /dev/null +++ b/roles/monitoring-master/tasks/main.yaml @@ -0,0 +1,17 @@ +- name: Clone Passive Monitoring + git: + repo: https://github.com/FAUSheppy/icinga-passive-checks-monitoring + dest: "/etc/monitoring/" + version: master + +- name: Copy nsca-ng and send_nsca to /bin/ + copy: + src: nsca-ng + dest: /bin/nsca-ng + mode: 0755 + +- name: Copy nsca-ng and send_nsca to /bin/ + copy: + src: send_nsca + dest: /bin/send_nsca + mode: 0755