install plugins on icinga master

This commit is contained in:
2023-12-10 20:23:00 -05:00
parent fa41a5bfd3
commit d9ec7b879b
3 changed files with 43 additions and 45 deletions

View File

@@ -1,48 +1,3 @@
# A deploy key must be added for this to work!
/usr/local/lib/nagios:
git.cloned:
- name: {{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}
- target: /usr/local/lib/nagios
- branch: master
- user: root
/usr/local/lib/nagios/venv:
cmd.run:
{% if 'inmotionhosting' in grains.fqdn %}
- name: imh-python3 -m venv /usr/local/lib/nagios/venv
{% else %}
- name: python3 -m venv /usr/local/lib/nagios/venv
{% endif %}
- creates: /usr/local/lib/nagios/venv
- require:
- git: /usr/local/lib/nagios
- pkg: monitoring_packages
# TODO: make all this venv stuff a cmd.script
venv-ensurepip:
cmd.run:
- name: /usr/local/lib/nagios/venv/bin/python3 -m ensurepip
- creates: /usr/local/lib/nagios/venv/bin/pip3
- require:
- cmd: /usr/local/lib/nagios/venv
venv-psutil:
cmd.run:
- name: /usr/local/lib/nagios/venv/bin/pip3 install psutil
- require:
- cmd: venv-ensurepip
monitoring_packages:
pkg.installed:
- pkgs:
- smartmontools
{% if grains.os_family == 'Debian' %}
- python3-venv
{% endif %}
icinga:
user.present:
- shell: /bin/bash