first upload
This commit is contained in:
parent
2a995fd4a8
commit
f56c899da5
4
inventory/group_vars/all.yml
Normal file
4
inventory/group_vars/all.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ZBXSERVER: '192.168.5.250'
|
||||||
|
ZBXLOGFILESIZE: '50'
|
||||||
|
ZBXAGENTPORT: '10050'
|
||||||
|
ZBXLISTENIP: '0.0.0.0'
|
66
playbook/install-zabbix-agent.yml
Normal file
66
playbook/install-zabbix-agent.yml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Zabbix Agent telepítése [Red Hat family]
|
||||||
|
yum:
|
||||||
|
name: zabbix-agent
|
||||||
|
state: latest
|
||||||
|
update_cache: yes
|
||||||
|
when:
|
||||||
|
- ansible_os_family == "RedHat"
|
||||||
|
|
||||||
|
- name: Zabbix Agent telepítése [Debian family]
|
||||||
|
apt:
|
||||||
|
name: zabbix-agent
|
||||||
|
state: latest
|
||||||
|
update_cache: yes
|
||||||
|
when:
|
||||||
|
- ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Zabbix Agent konfigurálása [CentOS]
|
||||||
|
lineinfile:
|
||||||
|
path: '/etc/zabbix_agentd.conf'
|
||||||
|
regexp: "{{ item.regexp }}"
|
||||||
|
line: "{{ item.line }}"
|
||||||
|
state: present
|
||||||
|
backup: yes
|
||||||
|
with_items:
|
||||||
|
- {regexp: '^\s*#?\s*Server\s*=', line: 'Server={{ ZBXSERVER }}'}
|
||||||
|
- {regexp: '^\s*#?\s*Hostname\s*=', line: 'Hostname={{ inventory_hostname_short }}'}
|
||||||
|
- {regexp: '^\s*#?\s*LogFileSize\s*=', line: 'LogFileSize={{ ZBXLOGFILESIZE }}'}
|
||||||
|
- {regexp: '^\s*#?\s*ListenPort\s*=', line: 'ListenPort={{ ZBXAGENTPORT }}'}
|
||||||
|
- {regexp: '^\s*#?\s*ListenIP\s*=', line: 'ListenIP={{ ZBXLISTENIP }}'}
|
||||||
|
notify:
|
||||||
|
- restart zabbix-agent
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "CentOS"
|
||||||
|
|
||||||
|
- name: Zabbix Agent konfigurálása [Debian family]
|
||||||
|
lineinfile:
|
||||||
|
path: '/etc/zabbix/zabbix_agentd.conf'
|
||||||
|
regexp: "{{ item.regexp }}"
|
||||||
|
line: "{{ item.line }}"
|
||||||
|
state: present
|
||||||
|
backup: yes
|
||||||
|
with_items:
|
||||||
|
- {regexp: '^\s*#?\s*Server\s*=', line: 'Server={{ ZBXSERVER }}'}
|
||||||
|
- {regexp: '^\s*#?\s*Hostname\s*=', line: 'Hostname={{ inventory_hostname_short }}'}
|
||||||
|
- {regexp: '^\s*#?\s*LogFileSize\s*=', line: 'LogFileSize={{ ZBXLOGFILESIZE }}'}
|
||||||
|
- {regexp: '^\s*#?\s*ListenPort\s*=', line: 'ListenPort={{ ZBXAGENTPORT }}'}
|
||||||
|
- {regexp: '^\s*#?\s*ListenIP\s*=', line: 'ListenIP={{ ZBXLISTENIP }}'}
|
||||||
|
notify:
|
||||||
|
- restart zabbix-agent
|
||||||
|
when:
|
||||||
|
- ansible_os_family == "Debian"
|
||||||
|
|
||||||
|
- name: Zabbix Agent engedélyezése és elindítása
|
||||||
|
service:
|
||||||
|
name: zabbix-agent
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: restart zabbix-agent
|
||||||
|
service: name=zabbix-agent state=restarted
|
Loading…
Reference in New Issue
Block a user