zabbix-server: Make it easier to use peer auth.

Quoting from the manual about DBHost:

```
In case of MySQL localhost or empty string results in using a socket. In case of
PostgreSQL only empty string results in attempt to use socket.
```
https://www.zabbix.com/documentation/2.0/manual/appendix/config/zabbix_server

With this commit we should avoid some race conditions in systemd, because if the
host is set to "", there is no condition that postgresql has to be started prior
to the Zabbix server.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2013-06-13 02:40:46 +02:00
parent a5c6a36466
commit 62d5282602
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -34,6 +34,8 @@ let
''}
'';
useLocalPostgres = cfg.dbServer == "localhost" || cfg.dbServer == "";
in
{
@ -51,7 +53,10 @@ in
services.zabbixServer.dbServer = mkOption {
default = "localhost";
description = "Hostname or IP address of the database server.";
description = ''
Hostname or IP address of the database server.
Use an empty string ("") to use peer authentication.
'';
};
services.zabbixServer.dbPassword = mkOption {
@ -65,7 +70,7 @@ in
config = mkIf cfg.enable {
services.postgresql.enable = cfg.dbServer == "localhost";
services.postgresql.enable = useLocalPostgres;
users.extraUsers = singleton
{ name = "zabbix";
@ -77,7 +82,7 @@ in
{ description = "Zabbix Server";
wantedBy = [ "multi-user.target" ];
after = optional (cfg.dbServer == "localhost") "postgresql.service";
after = optional useLocalPostgres "postgresql.service";
preStart =
''