Verified Commit fd8f3299 authored by Florian Pritz's avatar Florian Pritz
Browse files

zabbix-server: Check the exit code when checking if the db is populated

Without this the condition is always true and the first task may cause
the playbook to fail when the db is not populated. This should fix it.

Introduced in 6b9d0b04



Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent d724f8cd
...@@ -41,12 +41,14 @@ ...@@ -41,12 +41,14 @@
become_user: zabbix-server become_user: zabbix-server
become: yes become: yes
register: table_is_populated register: table_is_populated
failed_when: ( table_is_populated.rc not in [ 0, 1 ] )
changed_when: table_is_populated.rc != 0
- name: install database schema - name: install database schema
shell: psql -U "{{zabbix_db_user}}" "{{zabbix_db_name}}" < "/usr/share/zabbix-server/postgresql/{{item}}" shell: psql -U "{{zabbix_db_user}}" "{{zabbix_db_name}}" < "/usr/share/zabbix-server/postgresql/{{item}}"
become_user: zabbix-server become_user: zabbix-server
become: yes become: yes
when: not table_is_populated when: table_is_populated.rc != 0
with_items: with_items:
- schema.sql - schema.sql
- images.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