Merge pull request 'Update to v7' (#10) from v7 into main

Reviewed-on: #10
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2024-07-29 08:04:50 +02:00
commit 9a561feaf6
7 changed files with 34 additions and 26 deletions

View file

@ -11,7 +11,7 @@ The default login credentials for Zabbix are:
* Username: Admin
* Password: zabbix
⚠️ If mariadb is deployed on a different server than zabbix, then you have to do `mysql> set global log_bin_trust_function_creators = 1;` on your mariadb server, then deploy this role, and set it back to `mysql> set global log_bin_trust_function_creators = 0;`
⚠️ If mariadb is deployed on a different server than zabbix, then you have to do `mysql> set global log_bin_trust_function_creators = 1;` on your mariadb server, then deploy this role, and set it back with `mysql> set global log_bin_trust_function_creators = 0;`
## Zabbix-agent
@ -20,14 +20,14 @@ The default login credentials for Zabbix are:
## TODO
- Find better way than zabbix_proxy_installed: 'false' (01.08.23: it not needed anymore, but needs more tests)
- When a script needs for example psql for lufi script, then it won't work if the needed package (example postgresql-client) is not installed on the container that zabbix-agent runs on. We could add a task in `install_agent` that installs dependencies and have `zabbix_script_deps` var.
- It would be nice to have `userparameter_container.conf.j2` more vanilla as most of them won't work without the disroot scripts repo.
## CHANGELOG
- **29.07.24** - Update to v7.0
- **01.08.23** - Fix role issues and update to v6.0
- **15.01.2021** - Make it ready for public release
- Create readme file
- Create Playbook
- Create Vagrantfile
- **01.08.23** - Fix role issues and update to v6.0

2
Vagrantfile vendored
View file

@ -8,7 +8,7 @@
Vagrant.configure("2") do |config|
#config.ssh.insert_key = false
config.vm.define "zabbix" do |zabbix|
zabbix.vm.box = "generic/debian11"
zabbix.vm.box = "generic/debian12"
zabbix.vm.provider :libvirt do |libvirt|
libvirt.memory = 256
end

View file

@ -1,9 +1,7 @@
---
zabbix_proxy_installed: 'false' # set to false the first time you deploy proxy, then to true once it is deployed. NOT NEEDED ANYMORE?
#main
zabbix_version: '6.0'
zabbix_version: '7.0'
zabbix_agent: 'true' # set to true if you want to deploy it.
zabbix_server: 'true' # set to true if you want to deploy it.
zabbix_proxy: 'false' # set to true if you want to deploy it.
@ -58,7 +56,6 @@ zabbix_agent_listen_port: '10050'
zabbix_agent_pkg:
- zabbix-agent
- gzip
- zabbix-get
- zabbix-sender
#Zabbix Scripts

View file

@ -9,6 +9,7 @@
cache_valid_time: 3600
notify:
- restart zabbix_agent
tags: agent
- name: "[Agent] - Deploy Zabbix custom userparameters"
template:
@ -16,6 +17,7 @@
dest: '/etc/zabbix/zabbix_agentd.d/userparameter_container.conf'
notify:
- restart zabbix_agent
tags: agent
- name: "[Agent] - Deploy Zabbix scripts"
git:
@ -26,12 +28,14 @@
when: zabbix_scripts_deploy == 'true'
notify:
- restart zabbix_agent
tags: agent
- name: '[Agent] - Ensure config dir path exists'
file:
path: '/var/local/container-scripts'
state: 'directory'
mode: '0755'
tags: agent
- name: "[Agent] - Configure scripts"
template:
@ -40,8 +44,10 @@
when: zabbix_scripts_deploy == 'true'
notify:
- restart zabbix_agent
tags: agent
- name: "[Agent] - Make sure the service is enabled"
systemd:
name: zabbix-agent
enabled: yes
enabled: yes
tags: agent

View file

@ -9,17 +9,20 @@
cache_valid_time: 3600
notify:
- restart zabbix_proxy
tags: proxy
- name: '[Proxy] - Remove apache2'
apt:
name: "{{ zabbix_apache }}"
state: absent
tags: proxy
- name: "[Proxy] - Check if Zabbix proxy is already installed"
shell:
cmd: "{{ zabbix_server_db_plugin }} -h {{ zabbix_proxy_db_host }} -u {{ zabbix_proxy_db_user }} -p{{ zabbix_proxy_db_passwd }} {{ zabbix_proxy_db_name }} -se 'SELECT * from dbversion;'"
register: zabbixproxy_installed
ignore_errors: true
tags: proxy
- name: '[Proxy] - Importing Zabbix Proxy schema. Onetime only shot'
mysql_db:
@ -31,12 +34,13 @@
target: /usr/share/zabbix-sql-scripts/mysql/proxy.sql
when: "'ERROR' in zabbixproxy_installed.stderr"
# ERROR 1146 means the table doesn't exist
# when: zabbix_proxy_installed == 'false' NOT NEEDED ANYMORE?
notify:
- restart zabbix_server
tags: proxy
- name: "[Proxy] - Make sure the service is enabled"
systemd:
name: zabbix-proxy
enabled: yes
state: restarted
state: restarted
tags: proxy

View file

@ -9,6 +9,7 @@
cache_valid_time: 3600
notify:
- restart zabbix_server
tags: server
- name: '[Server] - Remove apache2'
apt:
@ -20,6 +21,7 @@
cmd: "{{ zabbix_server_db_plugin }} -h {{ zabbix_server_db_host }} -u {{ zabbix_server_db_user }} -p{{ zabbix_server_db_passwd }} {{ zabbix_server_db_name }} -se 'SELECT instanceid from config;'"
register: zabbix_installed
ignore_errors: true
tags: server
- name: '[Server] - Importing Zabbix database. Onetime only shot'
mysql_db:
@ -34,8 +36,10 @@
notify:
- restart zabbix_server
- restart nginx
tags: server
- name: "[Server] - Make sure the service is enabled"
systemd:
name: zabbix-server
enabled: yes
enabled: yes
tags: server

View file

@ -1,26 +1,23 @@
---
- name: Update
include: update.yml
- include_tasks: update.yml
- name: Manage apt apt_repository
include: apt.yml
- include_tasks: apt.yml
- name: Install Zabbix Server
include: install_server.yml
- include_tasks: install_server.yml
when: zabbix_server == 'true'
tags: server
- name: install Zabbix Agent
include: install_agent.yml
- include_tasks: install_agent.yml
when: zabbix_agent == 'true'
tags: agent
- name: Copy additional custom files for checks
include: custom_agent.yml
- include_tasks: custom_agent.yml
when: zabbix_agent == 'true'
tags: agent
- name: install Zabbix Proxy
include: install_proxy.yml
- include_tasks: install_proxy.yml
when: zabbix_proxy == 'true'
tags: proxy
- name: Configure Zabbix
include: configure.yml
- include_tasks: configure.yml