-
Notifications
You must be signed in to change notification settings - Fork 0
/
zabbix_3.2
81 lines (76 loc) · 2.36 KB
/
zabbix_3.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
- hosts: zabbix
user: root
vars:
#Define a password
password: password
handlers:
- name: restart httpd
service: name=httpd state=restarted
tasks:
- name: Install Zabbix Repo
yum:
name: http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
state: present
- name: Install Zabbix
yum: name={{ item }} state=installed
with_items:
- zabbix-server-mysql
- zabbix-web-mysql
- mariadb-server
- httpd
- php
- libselinux-python
- name: starting Mariadb
service: name={{ item }} state=started enabled=yes
with_items:
#- zabbix-server
- mariadb
- name: Install python mysqldb
yum: name=MySQL-python state=installed
- name: Create a Database and user
mysql_db: name=zabbix encoding=utf8 state=present
- name: Create a mysql user
mysql_user: name=zabbix password="{{ password }}" priv='*.*:ALL' state=present
- name: edit php.ini file
lineinfile: >
dest=/etc/php.ini
regexp="{{ item.regexp }}"
line="{{ item.line }}"
with_items:
- { regexp: '^;date.timezone', line: 'date.timezone = Europe/Skopje' }
notify: restart httpd
tags: Edit_httpd_config
- name: Import zabbix DB
shell: |
zcat /usr/share/doc/zabbix-server-mysql-3.2*/create.sql.gz | mysql -uzabbix -p"{{ password }}" zabbix
- name: Zabbix conf file
shell: |
echo '
<?php
// Zabbix GUI configuration file.
global $DB;
$DB["TYPE"] = "MYSQL";
$DB["SERVER"] = "localhost";
$DB["PORT"] = "0";
$DB["DATABASE"] = "zabbix";
$DB["USER"] = "zabbix";
$DB["PASSWORD"] = "{{ password }}";
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB["SCHEMA"] = "";
$ZBX_SERVER = "localhost";
$ZBX_SERVER_PORT = "10051";
$ZBX_SERVER_NAME = "";
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;' > /etc/zabbix/web/zabbix.conf.php
- name: edit zabbix_conf file set a password
lineinfile: >
dest=/etc/zabbix/zabbix_server.conf
regexp="{{ item.regexp }}"
line="{{ item.line }}"
with_items:
- { regexp: '^# DBPassword=', line: 'DBPassword={{ password }}' }
- name: starting Apache and Zabbix-server Services
service: name={{ item }} state=started enabled=yes
with_items:
- zabbix-server
- httpd