Use more reliable way to get mysql version

mysqladmin --version displays version of client instead of server one.
So we should make decision to run mysql upgrade or not based
on the server version. Also this task should be ran only when mariadb
is already deployed.
This will make possible to be more independent from client version.

Change-Id: Icd20b8c81337d37fba219aa6be482b391bdaedde
This commit is contained in:
Dmitriy Rabotyagov
2020-05-04 16:24:38 +03:00
parent 1ba6cc04f9
commit 5a33e9da0e
2 changed files with 3 additions and 2 deletions

View File

@@ -17,8 +17,8 @@
# version. If it is not assume it's nothing is installed.
- name: Check mysql version
shell: >
if which mysqladmin; then
mysqladmin --version | grep -w "{{ galera_major_version }}"
if which mysql; then
mysql -e "SHOW VARIABLES LIKE 'version';" --batch --skip-column-names | grep -w "{{ galera_major_version }}"
fi
register: mysqladmin_version
changed_when: false

View File

@@ -83,6 +83,7 @@
- always
- include_tasks: galera_upgrade.yml
when: galera_deployed | bool
tags:
- galera_server-upgrade