DEBOPS.ZABBIX_AGENT(5)

NAME
debops.zabbix_agent - Manage Zabbix agent with Ansible

SYNOPSIS

debops run service/zabbix_agent [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

The debops.zabbix_agent Ansible role can be used to configure a Zabbix agent on Debian/Ubuntu hosts.

GETTING STARTED

  Default configuration

The role supports multiple flavors of Zabbix Agent <https://www.zabbix.com/documentation/current/en/manual/appendix/agent_comparison> included in Debian, one if which needs to be specified using zabbix_agent__flavor variable (the default is C flavor). To change the installed flavor, the current installation needs to be removed - to do that, you can execute the role with and extra variable on the command line:

debops run service/zabbix_agent -e 'zabbix_agent__deploy_state=absent'

This will tell the role to remove the current installation. After that, by changing the zabbix_agent__flavor in the Ansible inventory, you can install a different flavor of the Zabbix Agent.

  Example inventory

To enable the Zabbix agent service on a host it needs to be included in the specific Ansible inventory group:

[debops_service_zabbix_agent]
hostname

  Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.zabbix_agent role:

---
- name: Install and manage Zabbix agent
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_zabbix_agent' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: ferm
      tags: [ 'role::ferm', 'skip::ferm' ]
      ferm__dependent_rules:
        - '{{ zabbix_agent__ferm__dependent_rules }}'
    - role: zabbix_agent
      tags: [ 'role::zabbix_agent', 'skip::zabbix_agent' ]

DEFAULT VARIABLE DETAILS

Some of debops.zabbix_agent default variables have more extensive configuration than simple strings or lists, here you can find documentation and examples for them.

  zabbix_agent__configuration

The zabbix_agent__*_configuration variables define the contents of the /etc/zabbix_agent.conf configuration file. The variables are combined in order defined in the zabbix_agent__combined_configuration variable and can affect each other.

  Examples

Enable the Zabbix agent to allow all Zabbix servers on the 192.168.1.0/24 network:

zabbix_agent__configuration:
 - name: 'Server'
   value: '127.0.0.1,192.168.1.0/24'
   state: 'present'

You can see more examples in the default set of configuration options defined by the role.

  Syntax

The configuration is defined as a list of YAML dictionaries, using the Universal Configuration format. The configuration entries can be specified as simple "key: value" dictionaries, or if the name parameter is used, can be defined using specific parameters:

name
    Required. The name of the configuration option. Multiple entries with the same name parameter are merged together in order of appearance and can affect each other.

option
    Optional. Name of the configuration option, which will be used instead of the name parameter. This is useful when a Zabbix Agent option can be present multiple times in the configuration file.

value
    The value of a given configuration option. It can be a string, a number, or a boolean value - this is used to specify selected configuration options more than once. Empty strings are allowed.

state
    Optional. If not specified or present, a given configuration option will be included in the generated config file. If absent, a given configuration option will not be included in the file. If comment, the option will be included, but commented out. If ignore, a given configuration entry will not be processed during role execution.

comment
    Optional. A comment about a given configuration option.

AUTHOR
Julien Lecomte

COPYRIGHT
2014-2024, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others