Improvements in the proxy deply. Now it have two separate files and uses hostname as a proxy hostname
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- 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
|
||||
vars_files:
|
||||
- ../secrets.yml
|
||||
@@ -17,12 +17,10 @@
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Create Zabbix proxy configuration file
|
||||
- name: Create Zabbix proxy custom configuration file
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/zabbix/zabbix_proxy.conf.d/mbuz.conf
|
||||
dest: /etc/zabbix/zabbix_proxy.conf.d/custom.conf
|
||||
content: |
|
||||
Server={{ zabbix_server_address }}:10051
|
||||
Hostname={{ zabbix_proxy_hostname }}
|
||||
DBName=/tmp/zabbix_proxy
|
||||
StartPollers=2
|
||||
StartPreprocessors=1
|
||||
@@ -33,13 +31,21 @@
|
||||
EnableRemoteCommands=1
|
||||
TLSConnect=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 }}
|
||||
notify: restart zabbix-proxy
|
||||
|
||||
- name: Create Zabbix proxy PSK file
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/zabbix/proxy.psk
|
||||
dest: /etc/zabbix/{{ ansible_facts.hostname }}.psk
|
||||
content: "{{ zabbix_proxy_psk }}"
|
||||
owner: zabbix
|
||||
group: zabbix
|
||||
@@ -65,4 +71,4 @@
|
||||
that:
|
||||
- "ansible_facts.services['zabbix-proxy.service'].state == 'running'"
|
||||
fail_msg: "Zabbix proxy is not running"
|
||||
success_msg: "Zabbix proxy is running"
|
||||
success_msg: "Zabbix proxy is running"
|
||||
Reference in New Issue
Block a user