Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
infra
ansible-shared
zabbix
Commits
706deead
Commit
706deead
authored
Oct 13, 2016
by
Lars Beckers
Browse files
complete zabbix frontend deployment
parent
f9390e8f
Changes
8
Hide whitespace changes
Inline
Side-by-side
zabbix-frontend/files/10-uwsgi.conf
0 → 100644
View file @
706deead
d
/
run
/
uwsgi
0755
root
root
- -
d
/
run
/
uwsgi
/
app
0755
root
root
- -
zabbix-frontend/files/10-zabbix.conf
0 → 100644
View file @
706deead
d
/
run
/
uwsgi
/
app
/
zabbix
0775
zabbix
zabbix
- -
zabbix-frontend/files/zabbix-frontend.service
0 → 100644
View file @
706deead
[Unit]
Description
=
Zabbix Web Frontend
After
=
network.target
[Service]
ExecStart
=
/usr/bin/uwsgi --ini /etc/uwsgi/apps-available/zabbix.ini
Restart
=
always
KillSignal
=
SIGQUIT
Type
=
notify
NotifyAccess
=
all
[Install]
WantedBy
=
multi-user.target
zabbix-frontend/files/zabbix.conf
0 → 100644
View file @
706deead
location
/
zabbix
{
# if ($scheme ~ ^http:){
# rewrite ^(.*)$ https://$host$1 permanent;
# }
root
/
usr
/
share
;
index
index
.
php
;
error_page
403
404
502
503
504
/
zabbix
/
index
.
php
;
location
~ \.
php
$ {
# if (!-f $request_filename) { return 404; }
# expires epoch;
# include /etc/nginx/fastcgi_params;
# fastcgi_index index.php;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
include
uwsgi_params
;
uwsgi_modifier1
14
;
uwsgi_pass
unix
:///
run
/
uwsgi
/
app
/
zabbix
/
zabbix
.
sock
;
}
location
~ \.(
jpg
|
jpeg
|
gif
|
png
|
ico
)$ {
access_log
off
;
expires
33
d
;
}
}
zabbix-frontend/files/zabbix.ini
0 → 100644
View file @
706deead
[uwsgi]
uwsgi-socket
=
/run/uwsgi/app/zabbix/zabbix.sock
chmod-socket
=
660
chown-socket
=
zabbix:www-data
autoload
=
master =
processes
=
4
workers
=
4
prio
=
-5
harakiri
=
5
chdir
=
/usr/share/zabbix
uid
=
zabbix
gid
=
zabbix
logto
=
/var/log/uwsgi-zabbix.log
logfile-chown
=
zabbix:zabbix
logfile-chmod
=
664
log-date
=
log-4xx =
log-5xx
=
log-x-forwarded-for =
plugin
=
php
php-index
=
index.php
php-set
=
date.timezone=Europe/Berlin
php-set
=
post_max_size=16M
php-set
=
max_execution_time=300
php-set
=
max_input_time=300
php-set
=
always_populate_raw_post_data=-1
zabbix-frontend/handlers/main.yml
View file @
706deead
...
...
@@ -3,3 +3,16 @@
-
name
:
restart zabbix frontend
service
:
name=zabbix-frontend state=restarted
-
name
:
create tmpfiles
command
:
systemd-tmpfiles --create
-
name
:
reload systemd service files
command
:
systemctl daemon-reload
-
name
:
restart postgres
service
:
name=postgresql state=restarted
delegate_to
:
"
{{
zabbix_db_host
}}"
-
name
:
restart nginx
service
:
name=nginx state=restarted
zabbix-frontend/tasks/main.yml
View file @
706deead
---
-
name
:
ensure there is an uwsgi temporary directory
copy
:
src=10-uwsgi.conf dest=/etc/tmpfiles.d/10-uwsgi.conf
notify
:
-
create tmpfiles
tags
:
-
config
-
zabbix
-
name
:
ensure there is an frontend app temporary directory
copy
:
src=10-zabbix.conf dest=/etc/tmpfiles.d/10-zabbix.conf
notify
:
-
create tmpfiles
tags
:
-
config
-
zabbix
-
name
:
ensure the systemd service file is available
copy
:
src=zabbix-frontend.service dest=/etc/systemd/system/zabbix-frontend.service
notify
:
-
reload systemd service files
-
restart zabbix frontend
tags
:
-
service
-
zabbix
-
name
:
ensure the frontend package is installed
apt
:
name=zabbix-frontend-php state=latest
notify
:
...
...
@@ -8,9 +33,73 @@
-
packages
-
zabbix
# TODO configure frontend
# TODO create systemd/uwsgi unit and corresponding stuff
# TODO configure webserver
-
name
:
ensure php5-pgsql is available
apt
:
name=php5-pgsql state=latest
notify
:
-
restart zabbix frontend
tags
:
-
packages
-
zabbix
-
name
:
ensure the frontend app got some uwsgi config
copy
:
src=zabbix.ini dest=/etc/uwsgi/apps-available/zabbix.ini
notify
:
-
restart zabbix frontend
tags
:
-
config
-
zabbix
-
name
:
ensure a user executing the app exists
user
:
name=zabbix system=yes home=/usr/share/zabbix shell=/usr/sbin/nologin createhome=no group=zabbix state=present
notify
:
-
restart zabbix frontend
tags
:
-
user
-
zabbix
-
name
:
ensure an nginx config file is available
copy
:
src=zabbix.conf dest=/etc/nginx/sites-available/zabbix.conf
notify
:
-
restart nginx
tags
:
-
config
-
zabbix
-
name
:
ensure the frontend is enabled in nginx
lineinfile
:
dest=/etc/nginx/sites-available/main line="include /etc/nginx/sites-available/zabbix.conf;" insertbefore="}"
notify
:
-
restart nginx
tags
:
-
config
-
zabbix
-
name
:
ensure the frontend configuration file is installed
template
:
src=zabbix.conf.php.j2 dest=/etc/zabbix/web/zabbix.conf.php
notify
:
-
restart zabbix frontend
tags
:
-
config
-
zabbix
-
name
:
ensure the database server listens on the external interface
replace
:
dest=/etc/postgresql/9.4/main/postgresql.conf regexp="#listen_addresses = 'localhost'" replace="listen_addresses = '*'"
notify
:
-
restart postgres
delegate_to
:
"
{{
zabbix_db_host
}}"
tags
:
-
database
-
zabbix
-
name
:
ensure the database server allows connections from the server
lineinfile
:
dest=/etc/postgresql/9.4/main/pg_hba.conf insertafter="host all all 127.0.0.1/32 md5" line="host {{ zabbix_db_name }} {{ zabbix_db_user }} {{ ansible_fqdn }} md5" state=present
notify
:
-
restart postgres
delegate_to
:
"
{{
zabbix_db_host
}}"
tags
:
-
database
-
zabbix
-
meta
:
flush_handlers
-
name
:
ensure the frontend is enabled and running
service
:
name=zabbix-frontend state=running enabled=yes
...
...
zabbix-frontend/templates/zabbix.conf.php.j2
0 → 100644
View file @
706deead
<?php
// Zabbix GUI configuration file.
global
$DB
;
$DB
[
'TYPE'
]
=
'POSTGRESQL'
;
$DB
[
'SERVER'
]
=
'{{ zabbix_db_host }}'
;
$DB
[
'PORT'
]
=
'5432'
;
$DB
[
'DATABASE'
]
=
'{{ zabbix_db_name }}'
;
$DB
[
'USER'
]
=
'{{ zabbix_db_user }}'
;
$DB
[
'PASSWORD'
]
=
'{{ zabbix_db_password }}'
;
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB
[
'SCHEMA'
]
=
''
;
$ZBX_SERVER
=
'{{ zabbix_host }}'
;
$ZBX_SERVER_PORT
=
'10051'
;
$ZBX_SERVER_NAME
=
'{{ zabbix_name }}'
;
$IMAGE_FORMAT_DEFAULT
=
IMAGE_FORMAT_PNG
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment