Improvements in the proxy deply. Now it have two separate files and uses hostname as a proxy hostname

This commit is contained in:
2025-08-24 14:33:11 +02:00
parent 004264bb38
commit 416cccd1b6

View File

@@ -1,6 +1,6 @@
--- ---
- name: Install and Configure Zabbix Proxy - name: Install and Configure Zabbix Proxy
hosts: zabbix-proxy # Assuming you have a group for zabbix proxy in your inventory hosts: zabbix_proxy # Assuming you have a group for zabbix proxy in your inventory
become: yes become: yes
vars_files: vars_files:
- ../secrets.yml - ../secrets.yml
@@ -17,12 +17,10 @@
state: present state: present
update_cache: yes update_cache: yes
- name: Create Zabbix proxy configuration file - name: Create Zabbix proxy custom configuration file
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/zabbix/zabbix_proxy.conf.d/mbuz.conf dest: /etc/zabbix/zabbix_proxy.conf.d/custom.conf
content: | content: |
Server={{ zabbix_server_address }}:10051
Hostname={{ zabbix_proxy_hostname }}
DBName=/tmp/zabbix_proxy DBName=/tmp/zabbix_proxy
StartPollers=2 StartPollers=2
StartPreprocessors=1 StartPreprocessors=1
@@ -33,13 +31,21 @@
EnableRemoteCommands=1 EnableRemoteCommands=1
TLSConnect=psk TLSConnect=psk
TLSAccept=psk TLSAccept=psk
TLSPSKFile=/etc/zabbix/lxc-proxy.psk notify: restart zabbix-proxy
- name: Create Zabbix proxy connection configuration file
ansible.builtin.copy:
dest: /etc/zabbix/zabbix_proxy.conf.d/connection.conf
content: |
Server={{ zabbix_server_address }}:10051
Hostname={{ ansible_facts.hostname }}
TLSPSKFile=/etc/zabbix/{{ ansible_facts.hostname }}.psk
TLSPSKIdentity={{ zabbix_psk_identity }} TLSPSKIdentity={{ zabbix_psk_identity }}
notify: restart zabbix-proxy notify: restart zabbix-proxy
- name: Create Zabbix proxy PSK file - name: Create Zabbix proxy PSK file
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/zabbix/proxy.psk dest: /etc/zabbix/{{ ansible_facts.hostname }}.psk
content: "{{ zabbix_proxy_psk }}" content: "{{ zabbix_proxy_psk }}"
owner: zabbix owner: zabbix
group: zabbix group: zabbix