added schema check

This commit is contained in:
muppeth 2022-05-12 23:20:01 +02:00
parent 4a2b9c13a8
commit 2f1375e671
Signed by: muppeth
GPG key ID: 0EBC7B9848D04031

View file

@ -12,9 +12,9 @@
owner: "{{ lacre_webgate_user }}"
group: "{{ lacre_webgate_group }}"
- name: '[Webgate] - Chec if db has tables'
- name: '[Webgate] - Check if db schema is loaded'
shell:
cmd: "mysql -h {{ rcube_db_hostname }} -u {{ lacre_db_username }} -p{{ lacre_db_password }} {{ lacre_db_name }} -se 'select * from gpgmw_keys;'"
cmd: mysql -h {{ lacre_db_host }} -u {{ lacre_db_username }} -p{{ lacre_db_password }} {{ lacre_db_name }} -se "SELECT EXISTS (SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA LIKE '{{ lacre_db_name }}' AND TABLE_TYPE LIKE 'BASE TABLE' AND TABLE_NAME = 'gpgmw_keys' );"
register: webgate_installed
ignore_errors: true
@ -26,6 +26,7 @@
login_user: "{{ lacre_db_username }}"
login_password: "{{ lacre_db_password }}"
target: "{{ lacre_app_dir }}/gpg-mailgate-web/schema.sql"
when: webgate_installed.stdout != '1'
- name: 'Webgate] - Deploy config'
template: