switching vps to be the icinga master
This commit is contained in:
@@ -1,44 +1,73 @@
|
||||
# todo: git clone to /usr/local/lib/nagios
|
||||
|
||||
# A deploy key must be added for this to work!
|
||||
{{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}:
|
||||
/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:
|
||||
# TODO: these are the Debian names. Figure out the others
|
||||
- monitoring-plugins-basic
|
||||
- smartmontools
|
||||
{% if grains.os_family == 'Debian' %}
|
||||
- python3-venv
|
||||
{% endif %}
|
||||
|
||||
nagios:
|
||||
icinga:
|
||||
user.present:
|
||||
- shell: /bin/bash
|
||||
- home: /var/lib/nagios
|
||||
- home: /var/lib/icinga
|
||||
- system: true
|
||||
- createhome: true
|
||||
|
||||
/var/lib/nagios/.ssh:
|
||||
/var/lib/icinga/.ssh:
|
||||
file.directory:
|
||||
- user: nagios
|
||||
- group: nagios
|
||||
- user: icinga
|
||||
- group: icinga
|
||||
- mode: 700
|
||||
- require:
|
||||
- user: nagios
|
||||
- user: icinga
|
||||
|
||||
/var/lib/nagios/.ssh/authorized_keys:
|
||||
/var/lib/icinga/.ssh/authorized_keys:
|
||||
file.managed:
|
||||
- user: nagios
|
||||
- group: nagios
|
||||
- user: icinga
|
||||
- group: icinga
|
||||
- mode: 400
|
||||
- contents_pillar: icinga2:nagios_rsa_pubkey
|
||||
- contents_pillar: icinga2:icinga_rsa_pubkey
|
||||
- require:
|
||||
- file: /var/lib/nagios/.ssh
|
||||
- file: /var/lib/icinga/.ssh
|
||||
|
||||
/etc/sudoers.d/nagios:
|
||||
/etc/sudoers.d/icinga:
|
||||
file.managed:
|
||||
- user: root
|
||||
- group: root
|
||||
|
||||
Reference in New Issue
Block a user