This commit is contained in:
jaydee 2024-12-17 00:32:20 +01:00
parent 0f72226de7
commit 5259f05665
3 changed files with 31 additions and 7 deletions

View File

@ -2,3 +2,4 @@
ansible.builtin.service:
name: docker.service
state: restarted
become: true

View File

@ -77,8 +77,8 @@
path: "{{ zabbix_agent_cfg }}"
regexp: "^Server=.*"
insertafter: '^# Server='
line: "Server=192.168.77.0/24,192.168.80.0/28"
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
line: "Server=192.168.77.0/24,172.30.0.0/24"
- name: Reconfigure zabbix agent ServerActive
ansible.builtin.lineinfile:
@ -86,6 +86,7 @@
regexp: "^ServerActive=.*"
line: "ServerActive={{ ZABBIX_SERVER }}"
- name: Reconfigure zabbix agent ListenPort
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
@ -97,19 +98,31 @@
# regexp: "^ListenIP=.*"
# line: "ListenIP=0.0.0.0"
- name: Reconfigure zabbix-agent2 hostname
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
regexp: "^Hostname=.*"
line: "Hostname={{ inventory_hostname }}"
- name: Reconfigure zabbix-agent2 config
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
insertafter: '^# UserParameter='
regexp: "^UserParameter=system.certs.*"
line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py"
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
when: inventory_hostname == 'nas.home.lan'
- name: Reconfigure zabbix-agent2 config
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
insertafter: '^# UserParameter='
regexp: "^UserParameter=system.certs.*"
line: "UserParameter=system.certs,python3 /usr/bin/cert_check2.py"
when: inventory_hostname == 'm-server.home.lan'
- name: Reconfigure zabbix-agent2 config
ansible.builtin.lineinfile:
@ -118,12 +131,16 @@
line: "UserParameter=rpi.hw.temp,/usr/bin/vcgencmd measure_temp"
when: inventory_hostname == 'rpi5.home.lan'
- name: Reconfigure zabbix-agent2 hostname
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
regexp: "^HostMetadata=.*"
insertafter: '^# HostMetadata='
line: "HostMetadata=linux;jaydee"
- name: Reconfigure zabbix-agent2 hostname
ansible.builtin.lineinfile:
path: "{{ zabbix_agent_cfg }}"
@ -132,6 +149,8 @@
line: "HostMetadata=server;jaydee"
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
- name: Add the user 'to group video
ansible.builtin.user:
name: zabbix
@ -139,6 +158,7 @@
append: yes
when: inventory_hostname != 'nas.home.lan'
- name: Restart zabbix-agent2 service
ansible.builtin.service:
name: zabbix-agent2.service
@ -146,9 +166,10 @@
enabled: true
when: inventory_hostname != 'nas.home.lan'
- name: Restart agent
ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart
when: inventory_hostname == 'nas.home.lan'
become: true
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"

View File

@ -1,5 +1,5 @@
---
- hosts: servers
- hosts: containers
roles:
- name: common
tags: common
@ -21,3 +21,5 @@
tags: ldap_client
- name: ssh_banner
tags: ssh_banner
- name: omv_backup
tags: omv_backup