wilmardo.nagios
wilmardo.nagios
This tool installs Nagios version 4.3.4 directly from the source code. Once installed, you can access Nagios at http://ip-address/nagios/ by using the username and password you set in the nagios_users variable. You can also install the NRPE client using wilmardo.nrpe_client, which allows Nagios to monitor your server.
Requirements
No special requirements.
Role Variables
Default usage
To use this tool simply, you only need to set these variables. For more complicated setups, check the Advanced usage section:
# Users allowed to log into the Nagios web interface.
nagios_users:
- user: nagiosadmin
pass: Password1change
Advanced usage
If you want to customize the setup further, you can use the following variables:
# Directory for downloaded files.
nagios_download_dir: "{{ ansible_env.HOME }}/nagios"
# Version of Nagios to install
nagios_version: 4.3.4
# Download URL for Nagios
nagios_url: "https://github.com/NagiosEnterprises/nagioscore/archive/nagios-{{ nagios_version }}.tar.gz"
# Name of the extracted Nagios directory
nagios_src: "nagioscore-nagios-{{ nagios_version }}"
# Version of Nagios Plugins to install
nagios_plugins_version: 2.2.1
# Download URL for Nagios Plugins
nagios_plugins_url: "https://github.com/nagios-plugins/nagios-plugins/archive/release-{{ nagios_plugins_version }}.tar.gz"
# Name of the extracted Nagios Plugins directory
nagios_plugins_src: "nagios-plugins-release-{{ nagios_plugins_version }}"
# User for running the Nagios service
nagios_monitoring_user: nagios
# Group for running the Nagios service
nagios_monitoring_command_group: nagios
Dependencies
No dependencies.
Example Playbook
Here’s how to install Nagios and set the password for the nagiosadmin user. It’s better to place nagios_users
in the host_vars of your project, but this example works too:
- hosts: nagios
roles:
- { role: wilmardo.nagios, nagios_users: [{name: nagiosadmin, pass: Password1change}, {name: nagiosadmin1, pass: Password2change}] } }
Upgrading
To upgrade Nagios, change the version like this:
nagios_version: 4.3.4
You will need to remove some old files during the upgrade. Check build-nagios.yml for more details.
License
This tool is licensed under BSD-3-Clause-Clear.
Author Information
This role was first created by Patrick Ogenstad and later forked by Wilmar den Ouden in 2017.
Role to install Nagios 4 with nagios-plugins and check_nrpe plugin
ansible-galaxy install wilmardo.nagios