Skip to content

fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat), move sql file path to defaults #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zabbix/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ zabbix:
dbname: zabbix
dbuser: zabbix
dbpassword: zabbix
sql_file: /usr/share/doc/zabbix-server-pgsql/create.sql.gz
1 change: 1 addition & 0 deletions zabbix/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ Suse:
pgsql:
pkgs:
- postgresql
- gzip
sql_file: /usr/share/doc/packages/zabbix-server-pgsql/create.sql.gz


Expand Down
4 changes: 2 additions & 2 deletions zabbix/pgsql/schema.sls
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% set dbroot_user = settings.get('dbroot_user') -%}
{% set dbroot_pass = settings.get('dbroot_pass') -%}

{% set sql_file = settings.get('sql_file', '/usr/share/doc/zabbix-server-pgsql/create.sql.gz') -%}
{% set sql_file = settings.get('sql_file', defaults.sql_file) -%}

# Connection args required only if dbroot_user and dbroot_pass defined.
{% set connection_args = {} -%}
Expand Down Expand Up @@ -51,7 +51,7 @@ upload_sql_dump:

import_sql:
cmd.run:
- name: zcat {{ sql_file }} | psql | head -5
- name: zcat {{ sql_file }} | psql | { head -5; cat >/dev/null; }
- runas: {{ zabbix.user }}
- env:
- PGUSER: {{ dbuser }}
Expand Down