From 8f80fa5dfec6089535f0885c6acb91d733b9afa5 Mon Sep 17 00:00:00 2001 From: marrco Date: Mon, 20 Nov 2017 11:40:46 +0100 Subject: [PATCH] Fix my.cnf for incompatible options when mysql-server >= 5.7 --- tasks/configure.yml | 4 ++++ templates/etc_mysql_my.cnf.j2 | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 3c949ed..842a0e9 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,5 +1,9 @@ # file: mysql/tasks/configure.yml +- name: MySQL | Get version number + command: mysql --version | sed -e 's/.*Distrib \([0-9\.]*\).*/\1/' + register: mysql_version + - name: MySQL | Update the my.cnf template: src: etc_mysql_my.cnf.j2 diff --git a/templates/etc_mysql_my.cnf.j2 b/templates/etc_mysql_my.cnf.j2 index 1f61bf0..d00c7e6 100644 --- a/templates/etc_mysql_my.cnf.j2 +++ b/templates/etc_mysql_my.cnf.j2 @@ -33,7 +33,7 @@ thread_cache_size = {{ mysql_cache_size }} max_connections = {{ mysql_max_connections }} table_open_cache = {{ mysql_table_cache }} max_allowed_packet = {{ mysql_max_allowed_packet }} -{% if not '5.7' in mysql_ppa %} +{% if mysql_version | version_compare('5.7', '<=') %} # ** Not compatible with 5.7 key_buffer = {{ mysql_key_buffer }} myisam-recover = {{ mysql_myisam_recover }}