2021-01-03 15:10:04 +00:00
|
|
|
---
|
|
|
|
- name: Converge
|
|
|
|
hosts: all
|
|
|
|
roles:
|
|
|
|
- ansible-role-icinga2
|
|
|
|
pre_tasks:
|
|
|
|
- name: update apt cache
|
2021-08-15 16:15:12 +00:00
|
|
|
ansible.builtin.apt:
|
2021-01-03 15:10:04 +00:00
|
|
|
update_cache: true
|
|
|
|
vars:
|
|
|
|
icinga2_ido_host: 127.0.0.1
|
|
|
|
icinga2_ido_user: icinga
|
|
|
|
icinga2_ido_password: test
|
|
|
|
icinga2_ido_database: icinga
|
|
|
|
icinga2_services:
|
|
|
|
ping:
|
|
|
|
check_command: ping
|
|
|
|
assign: host.address
|
|
|
|
ssh:
|
|
|
|
check_command: ssh
|
|
|
|
assign: (host.address || host.address6) && host.vars.os == "Linux"
|
|
|
|
options:
|
|
|
|
event_command: ping_event
|
2021-08-15 16:42:01 +00:00
|
|
|
icinga2_notification_commands:
|
|
|
|
date:
|
|
|
|
script: test-notification.sh
|
|
|
|
icinga2_scripts:
|
|
|
|
test-notification.sh: |
|
|
|
|
#!/bin/bash
|
|
|
|
date >> /tmp/notification.log
|
2021-01-03 15:10:04 +00:00
|
|
|
icinga2_hosts:
|
|
|
|
localhost:
|
|
|
|
template: generic-host
|
|
|
|
address: 127.0.0.1
|
|
|
|
vars:
|
|
|
|
os: Linux
|
|
|
|
http_vhosts:
|
|
|
|
http:
|
|
|
|
http_vhosts: "/"
|
|
|
|
icinga:
|
|
|
|
http_vhosts: /icingaweb2
|
|
|
|
icinga2_check_commands:
|
|
|
|
https:
|
|
|
|
command: '[PluginDir + "/check_http"]'
|
|
|
|
arguments:
|
|
|
|
- name: -H
|
|
|
|
value: $http_vhost$
|
|
|
|
description: "Host name argument for servers using host headers (virtual host)"
|
|
|
|
required: true
|
|
|
|
icinga2_event_commands:
|
|
|
|
ping_event:
|
|
|
|
command: '"/usr/bin/ping -c 1 -t 1 127.0.0.1"'
|