dj-wasabi.zabbix-agent

Table of Contents

Introduction

This role has moved to: https://github.com/ansible-collections/community.zabbix/ A read-only version is available in this repo for those who cannot use collections yet. Updates will only happen in the new collection, not here.

Requirements

Operating Systems

This role works on:

  • Red Hat
  • Fedora
  • Debian
  • Ubuntu
  • openSUSE
  • Windows (Best effort)
  • macOS

You'll need one of these operating systems. Please send suggestions or pull requests if you want to use this role on others.

Local System Access

To install successfully, the role needs python-netaddr on the controller to manage IP addresses. This means the library must be available on your local machine, or pip needs to be installed. You may need sudo access and the -K flag to enter your password if not running as root.

Zabbix Versions

Supported operating systems with Zabbix releases:

Zabbix 4.4

  • CentOS 7.x, 8.x
  • Amazon 7.x
  • Red Hat 7.x, 8.x
  • Fedora 27, 29
  • Oracle Linux 7.x, 8.x
  • Scientific Linux 7.x, 8.x
  • Ubuntu 14.04, 16.04, 18.04
  • Debian 8, 9, 10
  • macOS 10.14, 10.15

Zabbix 4.2

(Same as Zabbix 4.4)

Zabbix 4.0

(Same as Zabbix 4.4)

Zabbix 3.4

  • CentOS 7.x
  • Amazon 7.x
  • Red Hat 7.x
  • Fedora 27, 29
  • Oracle Linux 7.x
  • Scientific Linux 7.x
  • Ubuntu 14.04, 16.04, 18.04
  • Debian 7, 8, 9

Zabbix 3.2

(Same as Zabbix 3.4 but with Debian 7, 8)

Zabbix 3.0

  • CentOS 5.x, 6.x, 7.x
  • Amazon 5.x, 6.x, 7.x
  • Red Hat 5.x, 6.x, 7.x
  • Oracle Linux 5.x, 6.x, 7.x
  • Scientific Linux 5.x, 6.x, 7.x
  • Ubuntu 14.04
  • Debian 7, 8

Zabbix 2.4

  • CentOS 6.x, 7.x
  • Amazon 6.x, 7.x
  • Red Hat 6.x, 7.x
  • Oracle Linux 6.x, 7.x
  • Scientific Linux 6.x, 7.x
  • Ubuntu 12.04, 14.04
  • Debian 7

Zabbix 2.2

  • CentOS 5.x, 6.x
  • Red Hat 5.x, 6.x
  • Oracle Linux 5.x, 6.x
  • Scientific Linux 5.x, 6.x
  • Ubuntu 12.04
  • Debian 7
  • XenServer 6

Getting Started

Installation

To install this role, simply run: ansible-galaxy install dj-wasabi.zabbix-agent. This will add the Zabbix agent role to your roles directory.

Minimal Configuration

To start the Zabbix Agent, you'll need these properties:

  • zabbix_agent_version
  • zabbix_agent_server
  • zabbix_agent_serveractive (if using active checks)

zabbix_agent_version is optional; if not set, the latest version will be installed. To use an older version, specify it in the format major.minor (e.g., zabbix_agent_version: 4.0).

zabbix_agent_server (and zabbix_agent_serveractive) should contain the IP or FQDN of the host running the Zabbix Server.

Issues

There is a known issue with Ansible versions 2.9.{0,1,2} not working correctly with Windows targets. More details can be found in issue #291.

Role Variables

Main Variables

Default variables in default/main.yml that might need to be overridden:

  • zabbix_agent_server: IP address for the Zabbix server or proxy.
  • zabbix_agent_serveractive: IP address for active checks.
  • zabbix_agent_version: Default is 4.4, can be changed to another supported version.
  • zabbix_repo: Where to install from (default: zabbix).
  • zabbix_agent_listeninterface: Interface for the agent to listen on. Leave blank for all.
  • zabbix_agent_package: Default package name is zabbix-agent.
  • zabbix_agent_package_state: Choose whether Zabbix-agent should be present or the latest version.
  • zabbix_agent_interfaces: List of interfaces for API configuration.
  • zabbix_selinux: Enables SELinux policy for the agent. Default: False.
  • zabbix_agent_userparameters: List of user parameters and scripts.
  • zabbix_agent_allowroot: If the agent can run as 'root'. Default: 0 (do not allow).
  • zabbix_agent_runas_user: Drop privileges to a specific user.
  • zabbix_agent_become_on_localhost: Default: True, change to False if not needed.
  • zabbix_install_pip_packages: Set to False to skip installing pip packages. Default: True.
  • zabbix_agent_apt_priority: Set the APT repository priority.

TLS Specific Configuration

For Zabbix 3.0 and higher, there are specific TLS variables for security settings during communication.

Zabbix API Variables

These variables are required for using the Zabbix API to manage hosts automatically.

  • zabbix_url: URL where Zabbix is accessible.
  • zabbix_api_http_user: Username for API access.
  • zabbix_api_http_password: Password for API access.
  • zabbix_api_create_hosts: Enable host creation via API.
  • zabbix_api_create_hostgroup: Enable host group creation via API.
  • Other API-related settings.

Windows Variables

Variables specifically for Windows, which is supported on a best-effort basis.

macOS Variables

Variables for macOS installations.

Docker Variables

For running the Zabbix Agent in a Docker container instead of installing it directly on the host.

Other Variables

Various additional configuration options like firewall settings and host descriptions.

IPMI Variables

Settings for IPMI management.

Proxy

Settings to use a proxy for downloading packages if the target host cannot access the internet.

Dependencies

No dependencies on other roles.

Example Playbook

Agent Interfaces

A sample to configure the Zabbix agent interface.

Other Interfaces

Configure additional interfaces like SNMP, JMX, and IPMI.

Variables in Role Configuration

Example to show how to pass variables while using the role.

Combination of Group Vars and Playbook

How to use group_vars or host_vars to set needed variables for the role.

Example for TLS PSK Encrypted Agent Communication

Set variables for managing encrypted communication between the agent and server.

Molecule

This role is tested with Molecule to ensure quality. It runs tests with different scenarios using Docker containers.

Default

Basic installation scenarios with multiple Linux distributions.

With Server

Install a Zabbix Server in a container, then install the Zabbix agents and verify connections.

Before Last Version

Run a similar scenario as default but using the previous Zabbix version.

Deploying User Parameters

Steps to install custom user parameters or scripts for Zabbix.

License

MIT

Author Information

Suggestions or pull requests are welcome to improve this role. Report any issues to the author.

GitHub: https://github.com/dj-wasabi/ansible-zabbix-agent

Email: ikben [at] werner-dijkerman . nl

Informazioni sul progetto

Installing and maintaining zabbix-agent for RedHat/Debian/Ubuntu/Windows/Suse.

Installa
ansible-galaxy install dj-wasabi.zabbix-agent
Licenza
mit
Download
4.2M
Proprietario
DevOps Engineer, Technical reviewer Packt Pub / Manning / BPB Online / O'Reilly Media