Verified Commit 6b9d0b04 authored by Florian Pritz's avatar Florian Pritz
Browse files

zabbix-server: Check if DB table is populated before installing schema


Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent 7715c00e
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment