diff --git a/playbooks/00_install_zabbix_agent.yml b/playbooks/00_install_zabbix_agent.yml index 50cbdb6..2421c58 100644 --- a/playbooks/00_install_zabbix_agent.yml +++ b/playbooks/00_install_zabbix_agent.yml @@ -1,7 +1,7 @@ - hosts: datacenter name: Install zabbix agent vars: - ZABBIX_SERVER_IP: "192.168.77.216" + ZABBIX_SERVER: "zabbix-server.lan" tasks: - name: Combine list1 and list2 into a merged_list var @@ -85,7 +85,7 @@ ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" regexp: "^ServerActive=.*" - line: "ServerActive={{ ZABBIX_SERVER_IP }}" + line: "ServerActive={{ ZABBIX_SERVER }}" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" - name: Reconfigure zabbix agent ListenPort @@ -108,11 +108,18 @@ - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}" - regexp: "^UserParameter=.*" insertafter: '^# UserParameter=' line: "UserParameter=system.temperature,vcgencmd measure_temp" become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + - name: Reconfigure zabbix-agent2 config + ansible.builtin.lineinfile: + path: "{{ zabbix_agent_cfg }}" + insertafter: '^# UserParameter=' + line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py" + become: "{{ 'no' if inventory_hostname in groups['nas'] else 'yes' }}" + when: inventory_hostname not in groups['nas'] + - name: Reconfigure zabbix-agent2 hostname ansible.builtin.lineinfile: path: "{{ zabbix_agent_cfg }}"