Skip to content

Commit 2c2b84f

Browse files
authored
Merge pull request #150 from ghormoon/pgsql-dont-create-db-and-user-with-schema
fix(pgsql): do not try to create db and user with schema
2 parents 7cd3cf5 + 058a800 commit 2c2b84f

File tree

4 files changed

+44
-33
lines changed

4 files changed

+44
-33
lines changed

docs/README.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,20 @@ Creates database and mysql user for Zabbix.
197197

198198
Creates mysql schema for Zabbix.
199199

200+
``zabbix.pgsql.pkgs``
201+
^^^^^^^^^^^^^^^^^^^^^^^
202+
203+
Install required psql packages.
204+
200205
``zabbix.pgsql.conf``
201206
^^^^^^^^^^^^^^^^^^^^^
202207

203-
Creates database and PostgreSQL user for Zabbix.
208+
Creates database and PostgreSQL user for Zabbix. Includes zabbix.pgsql.pkgs.
204209

205210
``zabbix.pgsql.schema``
206211
^^^^^^^^^^^^^^^^^^^^^^^
207212

208-
Creates PostgreSQL schema for Zabbix.
213+
Creates PostgreSQL schema for Zabbix. Includes zabbix.pgsql.pkgs.
209214

210215
``zabbix.proxy``
211216
^^^^^^^^^^^^^^^^

zabbix/pgsql/conf.sls

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,8 @@
1010
{% set dbroot_user = settings.get('dbroot_user') -%}
1111
{% set dbroot_pass = settings.get('dbroot_pass') -%}
1212
13-
# Install packages required for Salt postgres module
14-
{% if settings.get('pkgs', defaults.get('pkgs', False))
15-
and not settings.get('skip_pkgs', defaults.skip_pkgs) -%}
16-
pgsql_packages:
17-
pkg.installed:
18-
- pkgs: {{ settings.get('pkgs', defaults.pkgs)|json }}
19-
{% elif settings.get('skip_pkgs', defaults.skip_pkgs) -%}
20-
pgsql_packages:
21-
test.configurable_test_state:
22-
- name: You skipped installation of packages required for Salt postgres module.
23-
- changes: False
24-
- result: True
25-
{% else -%}
26-
pgsql_packages:
27-
test.configurable_test_state:
28-
- name: Packages required for Salt postgres module are not defined
29-
- changes: False
30-
- result: False
31-
- comment: |
32-
Additional packages are required to manage the PostgreSQL database.
33-
Please specify them in pillar as list.
34-
Tip: you need postgresql-client packages, like:
35-
zabbix-pgsql:
36-
pkgs:
37-
- postgresql-client-common
38-
- postgresql-client
39-
Or you can skip installing them, but formula likely fail without them.
40-
zabbix-pgsql:
41-
skip_pkgs: True
42-
{% endif -%}
13+
include:
14+
- zabbix.pgsql.pkgs
4315
4416
zabbix_pgsql_user:
4517
postgres_user.present:

zabbix/pgsql/pkgs.sls

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% from "zabbix/map.jinja" import zabbix with context -%}
2+
{% set settings = salt['pillar.get']('zabbix-pgsql', {}) -%}
3+
{% set defaults = zabbix.get('pgsql', {}) -%}
4+
5+
# Install packages required for Salt postgres module
6+
{% if settings.get('pkgs', defaults.get('pkgs', False))
7+
and not settings.get('skip_pkgs', defaults.skip_pkgs) -%}
8+
pgsql_packages:
9+
pkg.installed:
10+
- pkgs: {{ settings.get('pkgs', defaults.pkgs)|json }}
11+
{% elif settings.get('skip_pkgs', defaults.skip_pkgs) -%}
12+
pgsql_packages:
13+
test.configurable_test_state:
14+
- name: You skipped installation of packages required for Salt postgres module.
15+
- changes: False
16+
- result: True
17+
{% else -%}
18+
pgsql_packages:
19+
test.configurable_test_state:
20+
- name: Packages required for Salt postgres module are not defined
21+
- changes: False
22+
- result: False
23+
- comment: |
24+
Additional packages are required to manage the PostgreSQL database.
25+
Please specify them in pillar as list.
26+
Tip: you need postgresql-client packages, like:
27+
zabbix-pgsql:
28+
pkgs:
29+
- postgresql-client-common
30+
- postgresql-client
31+
Or you can skip installing them, but formula likely fail without them.
32+
zabbix-pgsql:
33+
skip_pkgs: True
34+
{% endif -%}

zabbix/pgsql/schema.sls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
{% endif -%}
2929
3030
include:
31-
- zabbix.pgsql.conf
31+
- zabbix.pgsql.pkgs
3232
3333
check_db_pgsql:
3434
test.configurable_test_state:

0 commit comments

Comments
 (0)