Files
salt-states/icinga2/plugins.sls
2025-05-05 01:07:57 -04:00

48 lines
1.1 KiB
Plaintext

# A deploy key must be added for this to work!
{% set git_dir = '/usr/local/lib/icinga' %}
{% set venv_dir = '%s/venv' | format(git_dir) %}
{{ git_dir }}:
git.cloned:
- name: {{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}
- target: {{ git_dir }}
- branch: master
- user: root
{{ venv_dir }}:
cmd.run:
{% if 'inmotionhosting' in grains.fqdn %}
- name: imh-python3 -m venv {{ venv_dir }}
{% else %}
- name: python3 -m venv {{ venv_dir }}
{% endif %}
- creates: {{ venv_dir }}
- require:
- git: {{ git_dir }}
- pkg: monitoring_packages
venv-ensurepip:
cmd.run:
- name: {{ venv_dir }}/bin/python3 -m ensurepip
- creates: {{ venv_dir }}/bin/pip3
- require:
- cmd: {{ venv_dir }}
{#
venv-psutil:
cmd.run:
- name: {{ venv_dir }}/bin/pip3 install psutil
- unless: {{ venv_dir }}/bin/pip3 freeze | grep -q '^psutil='
- require:
- cmd: venv-ensurepip
#}
monitoring_packages:
pkg.installed:
- pkgs:
- smartmontools
{% if grains.os_family == 'Debian' %}
- python3-venv
{% endif %}