mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-23 20:39:26 +00:00
initial
This commit is contained in:
parent
0f72226de7
commit
5259f05665
@ -2,3 +2,4 @@
|
|||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: docker.service
|
name: docker.service
|
||||||
state: restarted
|
state: restarted
|
||||||
|
become: true
|
@ -77,8 +77,8 @@
|
|||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
regexp: "^Server=.*"
|
regexp: "^Server=.*"
|
||||||
insertafter: '^# Server='
|
insertafter: '^# Server='
|
||||||
line: "Server=192.168.77.0/24,192.168.80.0/28"
|
line: "Server=192.168.77.0/24,172.30.0.0/24"
|
||||||
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix agent ServerActive
|
- name: Reconfigure zabbix agent ServerActive
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
@ -86,6 +86,7 @@
|
|||||||
regexp: "^ServerActive=.*"
|
regexp: "^ServerActive=.*"
|
||||||
line: "ServerActive={{ ZABBIX_SERVER }}"
|
line: "ServerActive={{ ZABBIX_SERVER }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix agent ListenPort
|
- name: Reconfigure zabbix agent ListenPort
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
@ -97,19 +98,31 @@
|
|||||||
# regexp: "^ListenIP=.*"
|
# regexp: "^ListenIP=.*"
|
||||||
# line: "ListenIP=0.0.0.0"
|
# line: "ListenIP=0.0.0.0"
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix-agent2 hostname
|
- name: Reconfigure zabbix-agent2 hostname
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
regexp: "^Hostname=.*"
|
regexp: "^Hostname=.*"
|
||||||
line: "Hostname={{ inventory_hostname }}"
|
line: "Hostname={{ inventory_hostname }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix-agent2 config
|
- name: Reconfigure zabbix-agent2 config
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
insertafter: '^# UserParameter='
|
insertafter: '^# UserParameter='
|
||||||
regexp: "^UserParameter=system.certs.*"
|
regexp: "^UserParameter=system.certs.*"
|
||||||
line: "UserParameter=system.certs,python3 /share/ZFS530_DATA/.qpkg/ZabbixAgent/cert_check2.py"
|
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
|
- name: Reconfigure zabbix-agent2 config
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
@ -118,12 +131,16 @@
|
|||||||
line: "UserParameter=rpi.hw.temp,/usr/bin/vcgencmd measure_temp"
|
line: "UserParameter=rpi.hw.temp,/usr/bin/vcgencmd measure_temp"
|
||||||
when: inventory_hostname == 'rpi5.home.lan'
|
when: inventory_hostname == 'rpi5.home.lan'
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix-agent2 hostname
|
- name: Reconfigure zabbix-agent2 hostname
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
regexp: "^HostMetadata=.*"
|
regexp: "^HostMetadata=.*"
|
||||||
insertafter: '^# HostMetadata='
|
insertafter: '^# HostMetadata='
|
||||||
line: "HostMetadata=linux;jaydee"
|
line: "HostMetadata=linux;jaydee"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix-agent2 hostname
|
- name: Reconfigure zabbix-agent2 hostname
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
@ -132,6 +149,8 @@
|
|||||||
line: "HostMetadata=server;jaydee"
|
line: "HostMetadata=server;jaydee"
|
||||||
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
when: inventory_hostname == 'nas.home.lan' or inventory_hostname == 'm-server.home.lan'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Add the user 'to group video
|
- name: Add the user 'to group video
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: zabbix
|
name: zabbix
|
||||||
@ -139,6 +158,7 @@
|
|||||||
append: yes
|
append: yes
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
|
||||||
|
|
||||||
- name: Restart zabbix-agent2 service
|
- name: Restart zabbix-agent2 service
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: zabbix-agent2.service
|
name: zabbix-agent2.service
|
||||||
@ -146,9 +166,10 @@
|
|||||||
enabled: true
|
enabled: true
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
|
||||||
|
|
||||||
- name: Restart agent
|
- name: Restart agent
|
||||||
ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart
|
ansible.builtin.shell: /etc/init.d/ZabbixAgent.sh restart
|
||||||
when: inventory_hostname == 'nas.home.lan'
|
when: inventory_hostname == 'nas.home.lan'
|
||||||
|
|
||||||
|
|
||||||
become: true
|
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- hosts: servers
|
- hosts: containers
|
||||||
roles:
|
roles:
|
||||||
- name: common
|
- name: common
|
||||||
tags: common
|
tags: common
|
||||||
@ -21,3 +21,5 @@
|
|||||||
tags: ldap_client
|
tags: ldap_client
|
||||||
- name: ssh_banner
|
- name: ssh_banner
|
||||||
tags: ssh_banner
|
tags: ssh_banner
|
||||||
|
- name: omv_backup
|
||||||
|
tags: omv_backup
|
Loading…
x
Reference in New Issue
Block a user