Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
infrastructure
Commits
6b9d0b04
Verified
Commit
6b9d0b04
authored
Nov 16, 2018
by
Florian Pritz
Browse files
zabbix-server: Check if DB table is populated before installing schema
Signed-off-by:
Florian Pritz
<
bluewind@xinu.at
>
parent
7715c00e
Changes
1
Hide whitespace changes
Inline
Side-by-side
roles/zabbix-server/tasks/main.yml
View file @
6b9d0b04
...
...
@@ -35,10 +35,18 @@
template
:
src=pgpass.j2 dest="{{zabbix_pgpass}}" owner=zabbix-server group=zabbix-server mode=600
no_log
:
true
-
name
:
check if zabbix db contains tables
shell
:
psql -U {{zabbix_db_user}} {{zabbix_db_name}} -c '\d' | grep -P '\(\d+ rows\)'
become_user
:
zabbix-server
become
:
yes
register
:
table_is_populated
-
name
:
install database schema
shell
:
psql -U "{{zabbix_db_user}}" "{{zabbix_db_name}}" < "/usr/share/zabbix-server/postgresql/{{item}}"
become_user
:
zabbix-server
become
:
yes
when
:
not table_is_populated
with_items
:
-
schema.sql
-
images.sql
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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