defaults | ||
handlers | ||
meta | ||
tasks | ||
templates | ||
.gitignore | ||
README.md |
Ansible Role Nagios server (version 4)
This role install Apache2 and Nagios4 servers.
Supported distributions:
- Ubuntu 20.04 focal
Requirements
- Manually run httpwd to create the authentication file
- Check the template apache_vhost.j2 for the path to SSL certificates and update it.
To-Do
- Option to generate SSL certificate with let's encrypt
Role Variables
Check defaults/main.yml for a working example.
General variables
nagios_user: System user to run nagios nagios_group: System group of the nagios_user auth_user_file: File to store user and password with access to the web interface. nagios_admin_user: Admin user for the web interface nagios_admin_password: Admin user password
Dictionary nagios4_config
This dictionary will be read (using .items()) to generate the file /etc/nagios4/nagios.cfg so any supported Nagios4 configuration can be included
Dictionary cgi_config
This dictionary will be read (using .items()) to generate the file /etc/nagios4/cgi.cfg so any supported Nagios4 configuration can be included
List monitored_hosts
This is list of monitored hosts clients, optionally can include services specific for the host, but it's recommended to reduce this usage and include as many services as possible in the hostgroups list.
Example:
- host_name: localhost
use: linux-server
alias: Server0
address: 127.0.0.1
services:
- use: local-service
description: PING
check_command: check_ping!100.0,20%!500.0,60%
List hostgroups
This is a list of groups and their members (you have to declare the same members as hosts in monitored_hosts).
- hostgroup_name: linux servers
alias: Linux Servers
members:
- localhost
- server1
services:
- service_description: 'PING'
check_command: "check_ping!200.0,20%!500.0,60%"
Other lists
There are similar list of objects supported by Nagios like:
- commands
- contacts
- templates
- timeperiods
Apache specific virtual hosts list
The list vhosts contains at least one virtual host to configure Apache2.
- vhostname: nagios4.example.org
serveradmin: webmaster@example.org
vhost_aliases: nagios.example.org
ssl_certificate_file: "/etc/letsencrypt/live/nagios4.example.org/fullchain.pem"
ssl_certificate_key_file: "/etc/letsencrypt/live/nagios4.example.org/privkey.pem"
ssl_certificate_chain_file: "/usr/local/apache2/conf/ssl/ca_bundle.crt" # optional
Dependencies
None
License
GPLv3
Author Information
This role was created in 2022 by Antonio J. Delgado (ajdelgado).