updated role to zabbix 6.4

This commit is contained in:
muppeth 2023-05-09 00:13:59 +02:00
parent 7df6c0273b
commit 14d4b870e3
Signed by: muppeth
GPG Key ID: 0EBC7B9848D04031
3 changed files with 87 additions and 58 deletions

View File

@ -1,10 +1,7 @@
---
#zabbix_installed: 'false'
zabbix_proxy_installed: 'true'
#main
zabbix_version: '5.0'
zabbix_version: '6.4'
zabbix_agent: 'true'
zabbix_server: 'true'
zabbix_proxy: 'false'
@ -38,6 +35,13 @@ zabbix_server_fping6: '/usr/bin/fping6'
zabbix_server_queries_slow: '3000'
zabbix_cachesize: '8M'
zabbix_server_apt:
- zabbix-server-mysql
- zabbix-frontend-php
- zabbix-nginx-conf
- zabbix-sql-scripts
- gzip
- python3-pymysql
#Zabbix Client
zabbix_agent_params:
- name: "container"
@ -87,55 +91,73 @@ zabbix_proxy_data_sernder_freq: '1'
zabbix_proxy_start_pollers: '5'
zabbix_proxy_ipmi_pollers: '0'
#PHP Vars
php_version: '8.0'
php_etc_path: '/etc/php'
install_php: 'true'
pool_listen: '/var/run/php/php{{ php_version }}-fpm.sock'
php_pkgs:
- php{{ php_version }}-fpm
- php{{ php_version }}-bz2
- php{{ php_version }}-cgi
- php{{ php_version }}-cli
- php{{ php_version }}-common
- php{{ php_version }}-curl
- php{{ php_version }}-dev
- php{{ php_version }}-enchant
- php{{ php_version }}-gd
- php{{ php_version }}-gmp
- php{{ php_version }}-igbinary
- php{{ php_version }}-interbase
- php{{ php_version }}-intl
- php{{ php_version }}-mbstring # frontend
- php{{ php_version }}-msgpack
- php{{ php_version }}-pspell
- php{{ php_version }}-readline
- php{{ php_version }}-zip
- php{{ php_version }}-gd # frontend
- php{{ php_version }}-bcmath # frontend
- php{{ php_version }}-xml # frontend
- php{{ php_version }}-ldap # frontend
#nginx
nginx_default_vhost: 'zabbix'
nginx_default_vhost_ssl: 'zabbix'
#nginx_www_dir: '/var/www/'
nginx_vhosts:
- name: 'zabbix'
template: 'zabbix'
proto: 'http'
listen: '80'
root: '/usr/share/zabbix'
use_access_log: 'true'
use_error_log: 'true'
nginx_error_log_level: 'warn'
state: 'enable'
letsencrypt: 'false'
# MARIADB CONFIG
mariadb_default_config:
- name: 'client'
config:
- port = {{ mariadb_client_port }}
- socket = /var/run/mysqld/mysqld.sock
- default-character-set = utf8mb4
- name: 'mysqld_safe'
config:
- safe_socket = /var/run/mysqld/mysqld.sock
- safe_nice = 0
- name: 'mysqld'
config:
- user = mysql
- pid_file = /var/run/mysqld/mysqld.pid
- socket = /var/run/mysqld/mysqld.sock
- port = 3306
- basedir = /usr
- datadir = {{ mariadb_datadir }}
- tmpdir = /tmp
- init_connect ='SET collation_connection = utf8mb4_unicode_ci'
- init_connect ='SET NAMES utf8mb4'
- character-set-server = utf8mb4
- collation-server = utf8mb4_unicode_ci
- skip_external_locking = True
- bind_address = {{ zabbix_server_db_host }}
- key_buffer = 16M
- max_allowed_packet = 16M
- thread_stack = 192K
- thread_cache_size = 64
- myisam_recover = BACKUP
- max_connections = 1000
- general_log_file = /var/log/mysql/mysql.log
- general_log = 0
- slow_query_log = 1
- slow_query_log_file = /var/log/mysql/mysql-slow.log
- long_query_time = 1
- log_queries_not_using_indexes = False
- default_storage_engine = InnoDB
- innodb_buffer_pool_size = 4096M
- innodb_buffer_pool_instances = 2
- innodb_log_file_size = 128M
- innodb_log_buffer_size = 8M
- innodb_thread_concurrency = 64
- innodb_read_io_threads = 16
- innodb_write_io_threads = 16
- innodb_file_per_table = 1
- innodb_open_files = 400
- innodb_io_capacity = 600
- innodb_lock_wait_timeout = 60
- innodb_flush_method = O_DIRECT
- innodb_doublewrite = 0
- innodb_use_native_aio = 0
- innodb_large_prefix = on
- server_id = 1
- log_bin = /var/log/mysql/mysql-bin.log
- expire_logs_days = 2
- max_binlog_size = 10M
- binlog_format = row
- binlog_cache_size = 16M
- query_cache_type = 1
- query_cache_limit = 256K
- query_cache_min_res_unit = 2k
- query_cache_size = 64M
- tmp_table_size = 512M
- max_heap_table_size = 512M
- wait_timeout = 120
mariadb_databases:
- name: '{{ zabbix_server_db_name }}'
collation: 'utf8_general_ci' # should it be utf8_bin?

View File

@ -14,3 +14,8 @@
systemd:
name: zabbix-proxy
state: restarted
- name: restart nginx
systemd:
name: nginx
state: reloaded

View File

@ -2,11 +2,7 @@
- name: '[Server] - Install Zabbix from repository'
apt:
pkg:
- zabbix-server-mysql
- zabbix-frontend-php
- gzip
- python3-pymysql
pkg: "{{ zabbix_server_apt }}"
state: latest
update_cache: yes
install_recommends: no
@ -37,8 +33,14 @@
login_user: '{{ zabbix_server_db_user }}'
name: "{{ zabbix_server_db_name }}"
state: import
target: /usr/share/doc/zabbix-server-mysql/create.sql.gz
target: /usr/share/zabbix-sql-scripts/mysql/server.sql.gz
when: "'ERROR 1146' in zabbix_installed.stderr"
# ERROR 1146 means the table doesn't exist
notify:
- restart zabbix_server
- name: "[Server] - Remove default nginx vhost"
file:
path: '/etc/nginx/sites-enabled/default'
state: 'absent'
notify: restart nginx