Unverified Commit 3752d130 by Cory Lee Committed by GitHub

OPS-3333 Fix default character sets and collations in mysql playbook (#4707)

* OPS-3333 Fix default character sets and collations in mysql playbook

* Update

* Update mysql.yml

* Remove restart handler and just restart on each run

* Use new template syntax

* Fix syntax
parent 88286b59
...@@ -4,4 +4,8 @@ remove_experimental_mysql: false ...@@ -4,4 +4,8 @@ remove_experimental_mysql: false
mysql_debian_pkgs: mysql_debian_pkgs:
- "mysql-server-5.6" - "mysql-server-5.6"
- python-mysqldb - python-mysqldb
mysql_dir: /etc/mysql
DEFAULT_MYSQL_CHARACTER_SET: utf8
DEFAULT_MYSQL_COLLATION: utf8_general_ci
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
when: remove_experimental_mysql when: remove_experimental_mysql
- include: mysql.yml - include: mysql.yml
when: (mysql_56_installed.rc == 1) or (remove_experimental_mysql) when: (mysql_56_installed.rc == 1) or (remove_experimental_mysql)
\ No newline at end of file
...@@ -40,10 +40,18 @@ ...@@ -40,10 +40,18 @@
state: present state: present
with_items: "{{ mysql_debian_pkgs }}" with_items: "{{ mysql_debian_pkgs }}"
- name: Start mysql - name: Set default character sets and collations
template:
src: default_character_sets_and_collations.cnf.j2
dest: "{{ mysql_dir }}/mysql.conf.d/default_character_sets_and_collations.cnf"
owner: root
group: root
mode: 0644
- name: restart mysql
service: service:
name: mysql name: mysql
state: started state: restarted
- name: Ensure Anonymous user(s) does not exist - name: Ensure Anonymous user(s) does not exist
mysql_user: mysql_user:
......
# {{ ansible_managed }}
# This does not change any existing databases or rows, only the defaults for newly created databases
[client]
default-character-set={{ DEFAULT_MYSQL_CHARACTER_SET }}
[mysql]
default-character-set={{ DEFAULT_MYSQL_CHARACTER_SET }}
[mysqld]
collation-server = {{ DEFAULT_MYSQL_COLLATION }}
init-connect='SET NAMES {{ DEFAULT_MYSQL_CHARACTER_SET }}'
character-set-server = {{ DEFAULT_MYSQL_CHARACTER_SET }}
Markdown is supported
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