Skip to content

misho-kr/ansible-zabbix-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zabbix Deployment with Ansible

Automate the installation of Zabbix server, agents and plugins:

  • Zabbix server
  • Zabbix proxy
  • Zabbix agent
  • JMX gateway

Preparation

  1. Install Ansible (instructions)
  2. Get the playbook from the GitHub repository
  3. Create inventory file from this template and add the Zabbix hosts
> cat hosts

...
[zabbix-server]
zabbix-server.example.com

[zabbix-client:children]

[zabbiz-client-only]
zabbix-client-1.example.com
zabbix-client-2.example.com
zabbix-client-3.example.com

Zabbix server deployment

The procedure consists of 3 steps of which the 2nd one is manual and executes by you:

  1. Install server software packages
  2. Connect to server with browser and complete the configuration
  3. Install agent on the server host

The deployment is split into 2 phases because you have to connect to the server with browser and input some config parameters, as per server installation instruction. If there is a way to get around it please share it.

$ ansible-playbook -v -i hosts site.yml --limit zabbix-server -t server
...

# now switch to your browser and connect to the server
# and complete the configuration, then come back here

$ ansible-playbook -v -i hosts site.yml --limit zabbix-server -t agent

Options can be set at runtime to change the playbook actions:

  • zabbix_remove_stale_version -- uninstall packages, drop database, remove files (default=false)

Zabbix agent deployment

The playbook will register the remote hosts with the Zabbix server at the end of the installation.

$ ansible-playbook -v -i hosts site.yml -t agent --limit zabbix-client
...

Options can be set at runtime to change the playbook actions:

  • zabbix_remove_stale_version -- uninstall packages and remove remove files (default=false)
  • zabbix_register_with_server -- register hosts with Zabbix server (default=yes)
  • zabbix_api_connection_method -- make Zabbix server REST api calls from your laptop (default=local)

Note

  • If passwordless login is not enabled on the target hosts, use the "-k" option
  • If your user account on the target hosts requires password to execute sudo, then "-K" option is needed

Issues

  • Creating MySQL schema will fail due to bug in the mysql_db Ansible module. The workaround is to extract the sql file from the compressed gz file, place it in the home directory and change this [roles/zabbix-server/vars/main.yml](var file) and point it to the extracted file.

TODOs

  • LDAP authenticaiton setup on the server
  • Add support to run the playbook on RedHat, Fedora amd Ubuntu 16
  • Deployment of Zabbix proxy server
  • Fix the bug that breaks the MySQL schema creation and submit PR to Ansible
  • Create host screen after registering an agent host with Zabbix server
  • Deployment of JMX Gateway

Releases

No releases published

Packages

No packages published