initial commit

This commit is contained in:
pyrschtjag committed 2026-10-02 21:34:01 +04:00
commit 13eace9ce9
219 files changed
+6918

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
---
- name: restart zabbix server
ansible.builtin.systemd:
name: zabbix-server
state: restarted
enabled: true
- name: restart apache
ansible.builtin.systemd:
name: apache2
state: reloaded
enabled: true
+64
View File
@@ -0,0 +1,64 @@
---
- name: download zabbix package
ansible.builtin.get_url:
url: "https://repo.zabbix.com/zabbix/7.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian13_all.deb"
dest: "/tmp/zabbix-release_latest_7.4+debian13_all.deb"
mode: "0644"
- name: install zabbix release package
ansible.builtin.apt:
deb: "/tmp/zabbix-release_latest_7.4+debian13_all.deb"
state: present
- name: install zabbix server and frontend
ansible.builtin.apt:
name:
- zabbix-server-pgsql
- zabbix-frontend-php
- php8.4-pgsql
- zabbix-apache-conf
- zabbix-sql-scripts
state: present
update_cache: true
notify:
- restart zabbix server
- restart apache
- name: disable default db config
ansible.builtin.replace:
path: /etc/zabbix/zabbix_server.conf
regexp: '^(DB\w+=.*)$'
replace: '# \1'
notify: restart zabbix server
- name: deploy zabbix server config
ansible.builtin.template:
src: "{{ item }}"
dest: "/etc/zabbix/zabbix_server.d/{{ item | basename | regex_replace('\\.j2$', '') }}"
owner: root
group: root
mode: '0644'
loop: "{{ query('ansible.builtin.fileglob', role_path + '/templates/' + inventory_hostname + '/*.conf.j2') }}"
notify: restart zabbix server
- name: deploy zabbix frontend config
ansible.builtin.template:
src: "{{ inventory_hostname }}/zabbix.conf.php.j2"
dest: "/etc/zabbix/web/zabbix.conf.php"
owner: root
group: root
mode: "0644"
notify: restart zabbix server
- name: disable default apache site
ansible.builtin.command: a2dissite 000-default
args:
removes: /etc/apache2/sites-enabled/000-default.conf
notify: restart apache
- name: set zabbix apache alias to root
ansible.builtin.replace:
path: /etc/apache2/conf-enabled/zabbix.conf
regexp: '^(\s*)Alias /zabbix /usr/share/zabbix/ui\s*$'
replace: '\1Alias / /usr/share/zabbix/ui/'
notify: restart apache
@@ -0,0 +1,5 @@
DBHost={{ hostvars['pgsql'].ip }}
DBName=zabbix
DBUser=zabbix_user
DBPassword={{ database_password }}
DBPort=5432
@@ -0,0 +1,29 @@
<?php
$DB['TYPE'] = 'POSTGRESQL';
$DB['SERVER'] = '{{ hostvars['pgsql'].ip }}';
$DB['PORT'] = '5432';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix_user';
$DB['PASSWORD'] = '{{ database_password }}';
$DB['SCHEMA'] = '';
$DB['ENCRYPTION'] = true;
$DB['KEY_FILE'] = '';
$DB['CERT_FILE'] = '';
$DB['CA_FILE'] = '';
$DB['VERIFY_HOST'] = false;
$DB['CIPHER_LIST'] = '';
$DB['VAULT'] = '';
$DB['VAULT_URL'] = '';
$DB['VAULT_PREFIX'] = '';
$DB['VAULT_DB_PATH'] = '';
$DB['VAULT_TOKEN'] = '';
$DB['VAULT_CERT_FILE'] = '';
$DB['VAULT_KEY_FILE'] = '';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
$ZBX_SERVER_TLS['ACTIVE'] = false;
$ZBX_SERVER_TLS['CA_FILE'] = '';
$ZBX_SERVER_TLS['KEY_FILE'] = '';
$ZBX_SERVER_TLS['CERT_FILE'] = '';
$ZBX_SERVER_TLS['CERTIFICATE_ISSUER'] = '';
$ZBX_SERVER_TLS['CERTIFICATE_SUBJECT'] = '';