File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
+ - name : Get MySQL version.
3
+ command : ' mysql --version'
4
+ register : mysql_cli_version
5
+ changed_when : false
6
+
2
7
- name : Copy my.cnf global MySQL configuration.
3
8
template :
4
9
src : my.cnf.j2
Original file line number Diff line number Diff line change 1
1
---
2
- - name : Get MySQL version.
3
- command : ' mysql --version'
4
- register : mysql_cli_version
5
- changed_when : false
6
-
7
2
- name : Ensure default user is present.
8
3
mysql_user :
9
4
name : " {{ mysql_user_name }}"
43
38
mysql -u root -NBe
44
39
'ALTER USER "{{ mysql_root_username }}"@"{{ item }}" IDENTIFIED WITH mysql_native_password BY "{{ mysql_root_password }}";'
45
40
with_items : " {{ mysql_root_hosts.stdout_lines|default([]) }}"
46
- when : ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' in mysql_cli_version.stdout)
41
+ when : ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' in mysql_cli_version.stdout or '8.0.' in mysql_cli_version.stdout )
47
42
48
43
# Set root password for MySQL < 5.7.x.
49
44
- name : Update MySQL root password for localhost root account (< 5.7.x).
50
45
shell : >
51
46
mysql -NBe
52
47
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
53
48
with_items : " {{ mysql_root_hosts.stdout_lines|default([]) }}"
54
- when : ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' not in mysql_cli_version.stdout)
49
+ when : ((mysql_install_packages | bool) or mysql_root_password_update) and ('5.7.' not in mysql_cli_version.stdout and '8.0.' not in mysql_cli_version.stdout )
55
50
56
51
# Has to be after the root password assignment, for idempotency.
57
52
- name : Copy .my.cnf file with root password credentials.
Original file line number Diff line number Diff line change @@ -81,9 +81,11 @@ read_buffer_size = {{ mysql_read_buffer_size }}
81
81
read_rnd_buffer_size = {{ mysql_read_rnd_buffer_size }}
82
82
myisam_sort_buffer_size = {{ mysql_myisam_sort_buffer_size }}
83
83
thread_cache_size = {{ mysql_thread_cache_size }}
84
+ {% if '8.0.' not in mysql_cli_version .stdout %}
84
85
query_cache_type = {{ mysql_query_cache_type }}
85
86
query_cache_size = {{ mysql_query_cache_size }}
86
87
query_cache_limit = {{ mysql_query_cache_limit }}
88
+ {% endif %}
87
89
max_connections = {{ mysql_max_connections }}
88
90
tmp_table_size = {{ mysql_tmp_table_size }}
89
91
max_heap_table_size = {{ mysql_max_heap_table_size }}
@@ -96,7 +98,7 @@ lower_case_table_names = {{ mysql_lower_case_table_names }}
96
98
event_scheduler = {{ mysql_event_scheduler_state }}
97
99
98
100
# InnoDB settings.
99
- {% if mysql_supports_innodb_large_prefix %}
101
+ {% if mysql_supports_innodb_large_prefix and '8.0.' not in mysql_cli_version . stdout %}
100
102
innodb_large_prefix = {{ mysql_innodb_large_prefix }}
101
103
innodb_file_format = {{ mysql_innodb_file_format }}
102
104
{% endif %}
You can’t perform that action at this time.
0 commit comments