r0bj / ansible-zabbix-api

Ansible role to synchronize host data with Zabbix API
GNU General Public License v2.0
22 stars 10 forks source link

ansible Zabbix-API

This module will let you synchronize ansible hosts state with Zabbix. It means that it sets hosts via Zabbix API based on ansible variables:

Groups and Tempalates provided by ansible variables MUST be already present in Zabbix.

Web access from nodes managed by ansible to the Zabbix API should be allowed (firewall).

Make sure API user for provided credentials has enough permissions for host groups in Zabbix.

You can treat ansible inventory as an authoritative source of host information and sync it to Zabbix.

Tested on Zabbix 3.0.1.

Requirements

None.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

Example

Variables

zabbix_url: 'http://zabbixhost.com/api_jsonrpc.php'
zabbix_user: 'ansible'
zabbix_password: 'secretpassword'

zabbix_templates: 'mysql,nginx,php-fpm,LXC Containers,Web Test'
zabbix_groups: 'LXC Containers,Webservers'
zabbix_macros: '{$PAGE_STRING},Welcome on main page,{$SNMP_COMMUNITY},public'

Playbook

- name: zabbix API
  hosts: all
  roles:
    - role: r0bj.zabbix-api

License

MIT

Author Information

This role was created in 2014 by Robert Jerzak.