Skip to content

Commit 8969998

Browse files
author
Werner Dijkerman
committed
Updated meta data, also working zabbix-web version
1 parent 1a88902 commit 8969998

File tree

8 files changed

+157
-126
lines changed

8 files changed

+157
-126
lines changed

defaults/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
---
22
# defaults file for wdijkerman.zabbix
3+
4+
zabbix_url: zabbix.example.com
5+
zabbix_version: 2.4
6+
zabbix_timezone: Europe/Amsterdam
7+

meta/main.yml

+21-119
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,26 @@
11
---
22
galaxy_info:
33
author: Werner Dijkerman
4-
description: Installing and maintaining zabbix components
5-
company: your company (optional)
6-
# Some suggested licenses:
7-
# - BSD (default)
8-
# - MIT
9-
# - GPLv2
10-
# - GPLv3
11-
# - Apache
12-
# - CC-BY
13-
license: license (GPLv2, CC-BY, etc)
4+
description: Installing and maintaining zabbix-server for RedHat/Debian/Ubuntu.
5+
company: myCompany.Dotcom
6+
license: license (GPLv3)
147
min_ansible_version: 1.2
15-
#
16-
# Below are all platforms currently available. Just uncomment
17-
# the ones that apply to your role. If you don't see your
18-
# platform on this list, let us know and we'll get it added!
19-
#
20-
#platforms:
21-
#- name: EL
22-
# versions:
23-
# - all
24-
# - 5
25-
# - 6
26-
# - 7
27-
#- name: GenericUNIX
28-
# versions:
29-
# - all
30-
# - any
31-
#- name: Fedora
32-
# versions:
33-
# - all
34-
# - 16
35-
# - 17
36-
# - 18
37-
# - 19
38-
# - 20
39-
#- name: opensuse
40-
# versions:
41-
# - all
42-
# - 12.1
43-
# - 12.2
44-
# - 12.3
45-
# - 13.1
46-
# - 13.2
47-
#- name: Amazon
48-
# versions:
49-
# - all
50-
# - 2013.03
51-
# - 2013.09
52-
#- name: GenericBSD
53-
# versions:
54-
# - all
55-
# - any
56-
#- name: FreeBSD
57-
# versions:
58-
# - all
59-
# - 8.0
60-
# - 8.1
61-
# - 8.2
62-
# - 8.3
63-
# - 8.4
64-
# - 9.0
65-
# - 9.1
66-
# - 9.1
67-
# - 9.2
68-
#- name: Ubuntu
69-
# versions:
70-
# - all
71-
# - lucid
72-
# - maverick
73-
# - natty
74-
# - oneiric
75-
# - precise
76-
# - quantal
77-
# - raring
78-
# - saucy
79-
# - trusty
80-
#- name: SLES
81-
# versions:
82-
# - all
83-
# - 10SP3
84-
# - 10SP4
85-
# - 11
86-
# - 11SP1
87-
# - 11SP2
88-
# - 11SP3
89-
#- name: GenericLinux
90-
# versions:
91-
# - all
92-
# - any
93-
#- name: Debian
94-
# versions:
95-
# - all
96-
# - etch
97-
# - lenny
98-
# - squeeze
99-
# - wheezy
100-
#
101-
# Below are all categories currently available. Just as with
102-
# the platforms above, uncomment those that apply to your role.
103-
#
104-
#categories:
105-
#- cloud
106-
#- cloud:ec2
107-
#- cloud:gce
108-
#- cloud:rax
109-
#- clustering
110-
#- database
111-
#- database:nosql
112-
#- database:sql
113-
#- development
114-
#- monitoring
115-
#- networking
116-
#- packaging
117-
#- system
118-
#- web
119-
dependencies: []
120-
# List your role dependencies here, one per line. Only
121-
# dependencies available via galaxy should be listed here.
122-
# Be sure to remove the '[]' above if you add dependencies
123-
# to this list.
8+
platforms:
9+
- name: EL
10+
versions:
11+
- 6
12+
- 7
13+
- name: Ubuntu
14+
versions:
15+
- lucid
16+
- precise
17+
- trusty
18+
- name: Debian
19+
versions:
20+
- squeeze
21+
- wheezy
22+
categories:
23+
- monitoring
24+
dependencies:
25+
- { role: geerlingguy.apache }
12426

tasks/Debian.yml

+33-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
11
---
22
#
33

4+
- set_fact: apache_log="apache2"
5+
46
- name: Installing repository Debian
5-
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main" state=present
7+
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main"
8+
state=present
69
when: ansible_distribution == "Debian"
710

811
- name: Installing repository Debian
9-
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main" state=present
12+
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/debian/ {{ ansible_distribution_release }} main"
13+
state=present
1014
when: ansible_distribution == "Debian"
1115

1216
- name: Installing repository Ubuntu
13-
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main" state=present
17+
apt_repository: repo="deb http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main"
18+
state=present
1419
when: ansible_distribution == "ubuntu"
1520

1621
- name: Installing repository Ubuntu
17-
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main" state=present
22+
apt_repository: repo="deb-src http://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/ {{ ansible_distribution_release }} main"
23+
state=present
1824
when: ansible_distribution == "ubuntu"
1925

2026
- name: Install gpg key
2127
apt_key: url=http://repo.zabbix.com/zabbix-official-repo.key
2228

2329
- name: Installing Deb zabbix-server-{{ database_type }}
24-
apt: pkg=zabbix-server-{{ database_type }} state=present update_cache=yes
30+
apt: pkg=zabbix-server-{{ database_type }}
31+
state=present
32+
update_cache=yes
33+
34+
- name: Install Deb php5-{{ database_type }}
35+
apt: pkg=php5-{{ database_type }}
36+
state=present
37+
update_cache=yes
38+
39+
- name: Install Deb zabbix-web
40+
apt: pkg=zabbix-frontend-php
41+
state=present
42+
update_cache=yes
43+
44+
- name: install apache vhost
45+
template: src=apache_vhost.conf.j2
46+
dest=/etc/apache2/sites-enabled/zabbix.conf
47+
owner=root
48+
group=root
49+
mode=0644
50+
notify: restart apache
51+
52+
2553

tasks/RedHat.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
# Tasks specific for RedHat systems
33

4+
- set_fact: apache_log="httpd"
5+
46
- name: Install RH basic repo file
57
template: src=rhel.repo.j2
68
dest=/etc/yum.repos.d/zabbix.repo
@@ -9,5 +11,17 @@
911
mode=0644
1012

1113
- name: Installing RH zabbix-server-{{ database_type }}
12-
yum: pkg=zabbix-server-{{ database_type }} state=present
14+
yum: pkg=zabbix-server-{{ database_type }}
15+
state=present
16+
17+
- name: Install RH zabbix-web-{{ database_type }}
18+
yum: pkg=zabbix-web-{{ database_type }}
19+
state=present
1320

21+
- name: install apache vhost
22+
template: src=apache_vhost.conf.j2
23+
dest=/etc/httpd/conf.d/zabbix.conf
24+
owner=root
25+
group=root
26+
mode=0644
27+
notify: restart apache

tasks/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@
2323
group=zabbix
2424
state=directory
2525

26+
- name: Configure zabbix-web
27+
template: src=zabbix.conf.php.j2
28+
dest=/etc/zabbix/web/zabbix.conf.php
29+
owner=zabbix
30+
group=zabbix
31+
mode=0755

templates/apache_vhost.conf.j2

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<VirtualHost *:80>
2+
ServerName {{ zabbix_url }}
3+
4+
## Vhost docroot
5+
DocumentRoot "/usr/share/zabbix"
6+
7+
<Directory "/usr/share/zabbix">
8+
AllowOverride None
9+
Order Allow,Deny
10+
Allow from all
11+
</Directory>
12+
13+
<Directory "/usr/share/zabbix/conf">
14+
AllowOverride None
15+
Order Deny,Allow
16+
Deny from all
17+
</Directory>
18+
19+
<Directory "/usr/share/zabbix/api">
20+
AllowOverride None
21+
Order Deny,Allow
22+
Deny from all
23+
</Directory>
24+
25+
<Directory "/usr/share/zabbix/include">
26+
AllowOverride None
27+
Order Deny,Allow
28+
Deny from all
29+
</Directory>
30+
31+
<Directory "/usr/share/zabbix/include/classes">
32+
AllowOverride None
33+
Order Deny,Allow
34+
Deny from all
35+
</Directory>
36+
37+
## Logging
38+
ErrorLog "/var/log/{{ apache_log }}/{{ zabbix_url }}_error.log"
39+
ServerSignature Off
40+
CustomLog "/var/log/{{ apache_log }}/{{ zabbix_url }}_access.log" combined
41+
42+
## Rewrite rules
43+
RewriteEngine On
44+
RewriteRule ^$ /index.php [L]
45+
46+
## Custom fragment
47+
php_value max_execution_time 300
48+
php_value memory_limit 128M
49+
php_value post_max_size 16M
50+
php_value upload_max_filesize 2M
51+
php_value max_input_time 300
52+
# Set correct timezone.
53+
php_value date.timezone {{ zabbix_timezone }}
54+
</VirtualHost>

templates/zabbix.conf.php.j2

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
// Zabbix GUI configuration file
3+
global $DB;
4+
5+
$DB['TYPE'] = '{{ database_type_long|upper() }}';
6+
$DB['SERVER'] = '{{ server_dbhost }}';
7+
$DB['PORT'] = '0';
8+
$DB['DATABASE'] = '{{ server_dbname }}';
9+
$DB['USER'] = '{{ server_dbuser }}';
10+
$DB['PASSWORD'] = '{{ server_dbpassword }}';
11+
12+
// SCHEMA is relevant only for IBM_DB2 database
13+
$DB['SCHEMA'] = '';
14+
15+
$ZBX_SERVER = '{{ inventory_hostname }}';
16+
$ZBX_SERVER_PORT = '{{ server_listenport }}';
17+
$ZBX_SERVER_NAME = '{{ inventory_hostname_short }}';
18+
19+
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
20+
?>

vars/main.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
# vars file for wdijkerman.zabbix
33

44
# Some role specific vars
5-
zabbix_version: 2.4
65
#database_type: mysql
6+
#database_type_long: mysql
77
database_type: pgsql
8+
database_type_long: postgresql
89

10+
#
911

1012
# zabbix-server specific vars
1113
server_listenport: 10051

0 commit comments

Comments
 (0)