monitored/tasks/main.yml

47 lines
1.4 KiB
YAML
Raw Normal View History

2016-12-14 17:57:19 +00:00
---
2024-11-08 10:52:58 +00:00
- debug:
msg:
- "SSH: {{ monitored_by_ssh }}"
- "NRPE: {{ monitored_by_nrpe }}"
- name: Sanity checks
assert:
that:
2024-11-08 10:52:58 +00:00
- monitored_dont|default(false) != true
- monitored_by_nrpe == true or monitored_by_ssh == true
2021-02-18 12:00:21 +00:00
fail_msg: "Neither monitored_by_nrpe nor monitored_by_ssh set to True"
2016-12-14 17:57:19 +00:00
- name: Gather OS Specific Variables
include_vars: "{{ item }}"
with_first_found:
2018-03-13 18:05:20 +00:00
- "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_version|lower).split(' ')[0] }}.yml"
- "{{ (ansible_distribution|lower).split(' ')[0] }}-{{ (ansible_distribution_major_version|lower).split(' ')[0] }}.yml"
- "{{ (ansible_distribution|lower).split(' ')[0] }}.yml"
- "{{ (ansible_os_family|lower).split(' ')[0] }}.yml"
- name: "Install dependencies"
package:
name: "{{ monitored_packages_predepends }}"
state: latest
2024-11-08 10:52:58 +00:00
when: monitored_packages_predepends|default(false)
2016-12-14 17:57:19 +00:00
- name: "INCLUDE: Create monitoring user"
import_tasks: user.yml
2016-12-14 17:57:19 +00:00
- name: "INCLUDE: Install always necessary packages"
include_tasks: packages.yml
2024-11-08 10:52:58 +00:00
when: monitored_packages_install != false
2016-12-14 17:57:19 +00:00
- name: "INCLUDE: Copy custom plugins"
include_tasks: plugins_custom.yml
when: monitored_plugins_custom|default([]) != []
- name: "INCLUDE: Monitoring by NRPE"
include_tasks: nrpe.yml
2024-11-08 10:52:58 +00:00
when: monitored_by_nrpe == true
2016-12-14 17:57:19 +00:00
- name: "INCLUDE: Monitoring by SSH"
include_tasks: ssh.yml
2024-11-08 10:52:58 +00:00
when: monitored_by_ssh == true
2016-12-14 17:57:19 +00:00