mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-27 07:01:27 -07:00
Fix mysql_dump for MySQL 5.7 and MariaDB when using mysqldump 8
This commit is contained in:
parent
b973849b53
commit
9cb404b17b
4 changed files with 189 additions and 7 deletions
|
@ -36,7 +36,13 @@
|
||||||
command: "{{ mysql_command }} {{ db_latin1_name }} -e \"select * from testlatin1\""
|
command: "{{ mysql_command }} {{ db_latin1_name }} -e \"select * from testlatin1\""
|
||||||
register: output
|
register: output
|
||||||
|
|
||||||
- name: Dumping a table in Latin1 database
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Encoding | Dumping a table in Latin1 database
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
login_password: '{{ mysql_password }}'
|
login_password: '{{ mysql_password }}'
|
||||||
|
@ -46,6 +52,10 @@
|
||||||
encoding: latin1
|
encoding: latin1
|
||||||
target: "{{ latin1_file1 }}"
|
target: "{{ latin1_file1 }}"
|
||||||
state: dump
|
state: dump
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
|
|
@ -27,32 +27,72 @@
|
||||||
- "CREATE TABLE db1.t2 (id int)"
|
- "CREATE TABLE db1.t2 (id int)"
|
||||||
- "CREATE VIEW db2.v1 AS SELECT id from db1.t1"
|
- "CREATE VIEW db2.v1 AS SELECT id from db1.t1"
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Full dump without compression
|
- name: Dumps errors | Full dump without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump.sql
|
target: /tmp/full-dump.sql
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: full_dump
|
register: full_dump
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Full dump with gunzip
|
- name: Dumps errors | Full dump with gunzip
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump.sql.gz
|
target: /tmp/full-dump.sql.gz
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: full_dump_gz
|
register: full_dump_gz
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Distinct dump without compression
|
- name: Dumps errors | Distinct dump without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2.sql
|
target: /tmp/dump-db2.sql
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_db2
|
register: dump_db2
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Distinct dump with gunzip
|
- name: Dumps errors | Distinct dump with gunzip
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2.sql.gz
|
target: /tmp/dump-db2.sql.gz
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_db2_gz
|
register: dump_db2_gz
|
||||||
|
|
||||||
- name: Dumps errors | Check distinct dumps are changed
|
- name: Dumps errors | Check distinct dumps are changed
|
||||||
|
@ -67,29 +107,60 @@
|
||||||
query:
|
query:
|
||||||
- "DROP TABLE db1.t1"
|
- "DROP TABLE db1.t1"
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Full dump after drop t1 without compression
|
- name: Dumps errors | Full dump after drop t1 without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump-without-t1.sql
|
target: /tmp/full-dump-without-t1.sql
|
||||||
pipefail: true # This should do nothing
|
pipefail: true # This should do nothing
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
register: full_dump_without_t1
|
register: full_dump_without_t1
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Full dump after drop t1 with gzip without the fix
|
- name: Dumps errors | Full dump after drop t1 with gzip without the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump-without-t1.sql.gz
|
target: /tmp/full-dump-without-t1.sql.gz
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: full_dump_without_t1_gz_without_fix
|
register: full_dump_without_t1_gz_without_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Full dump after drop t1 with gzip with the fix
|
- name: Dumps errors | Full dump after drop t1 with gzip with the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: all
|
name: all
|
||||||
target: /tmp/full-dump-without-t1.sql.gz
|
target: /tmp/full-dump-without-t1.sql.gz
|
||||||
pipefail: true
|
pipefail: true
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: full_dump_without_t1_gz_with_fix
|
register: full_dump_without_t1_gz_with_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
@ -104,29 +175,59 @@
|
||||||
- full_dump_without_t1_gz_with_fix.msg is search(
|
- full_dump_without_t1_gz_with_fix.msg is search(
|
||||||
'references invalid table')
|
'references invalid table')
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Distinct dump after drop t1 without compression
|
- name: Dumps errors | Distinct dump after drop t1 without compression
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2-without_t1.sql
|
target: /tmp/dump-db2-without_t1.sql
|
||||||
pipefail: true # This should do nothing
|
pipefail: true # This should do nothing
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_db2_without_t1
|
register: dump_db2_without_t1
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Distinct dump after drop t1 with gzip without the fix
|
- name: Dumps errors | Distinct dump after drop t1 with gzip without the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2-without_t1.sql.gz
|
target: /tmp/dump-db2-without_t1.sql.gz
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_db2_without_t1_gz_without_fix
|
register: dump_db2_without_t1_gz_without_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dumps errors | Distinct dump after drop t1 with gzip with the fix
|
- name: Dumps errors | Distinct dump after drop t1 with gzip with the fix
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
state: dump
|
state: dump
|
||||||
name: db2
|
name: db2
|
||||||
target: /tmp/dump-db2-without_t1.sql.gz
|
target: /tmp/dump-db2-without_t1.sql.gz
|
||||||
pipefail: true
|
pipefail: true
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_db2_without_t1_gz_with_fix
|
register: dump_db2_without_t1_gz_with_fix
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
|
|
@ -384,6 +384,13 @@
|
||||||
|
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
# Dump existing databases
|
# Dump existing databases
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dump existing databases
|
- name: Dump existing databases
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
|
@ -396,6 +403,10 @@
|
||||||
- '{{ db3_name }}'
|
- '{{ db3_name }}'
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ dump1_file }}'
|
target: '{{ dump1_file }}'
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_result
|
register: dump_result
|
||||||
|
|
||||||
- name: Assert successful completion of dump operation (existing database)
|
- name: Assert successful completion of dump operation (existing database)
|
||||||
|
@ -437,6 +448,12 @@
|
||||||
name: '{{ dump2_file }}'
|
name: '{{ dump2_file }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
- name: Dump existing databases
|
- name: Dump existing databases
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
|
@ -446,6 +463,10 @@
|
||||||
name: all
|
name: all
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ dump2_file }}'
|
target: '{{ dump2_file }}'
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_result
|
register: dump_result
|
||||||
|
|
||||||
- name: assert successful completion of dump operation
|
- name: assert successful completion of dump operation
|
||||||
|
|
|
@ -89,7 +89,13 @@
|
||||||
name: '{{ dump_file2 }}'
|
name: '{{ dump_file2 }}'
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: state dump without department table.
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Dump and Import | State dump without department table.
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ db_user }}'
|
login_user: '{{ db_user }}'
|
||||||
login_password: '{{ db_user_unsafe_password }}'
|
login_password: '{{ db_user_unsafe_password }}'
|
||||||
|
@ -104,7 +110,11 @@
|
||||||
force: yes
|
force: yes
|
||||||
master_data: 1
|
master_data: 1
|
||||||
skip_lock_tables: yes
|
skip_lock_tables: yes
|
||||||
dump_extra_args: --skip-triggers
|
dump_extra_args: >-
|
||||||
|
--skip-triggers
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
config_file: '{{ config_file }}'
|
config_file: '{{ config_file }}'
|
||||||
restrict_config_file: yes
|
restrict_config_file: yes
|
||||||
check_implicit_admin: no
|
check_implicit_admin: no
|
||||||
|
@ -121,7 +131,13 @@
|
||||||
name: '{{ db_file_name }}'
|
name: '{{ db_file_name }}'
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: state dump with multiple databases in comma separated form.
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Dump and Import | State dump with multiple databases in comma separated form for MySQL.
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
login_password: '{{ mysql_password }}'
|
login_password: '{{ mysql_password }}'
|
||||||
|
@ -131,6 +147,10 @@
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ dump_file1 }}'
|
target: '{{ dump_file1 }}'
|
||||||
check_implicit_admin: yes
|
check_implicit_admin: yes
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_result1
|
register: dump_result1
|
||||||
|
|
||||||
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in comma separated form)
|
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in comma separated form)
|
||||||
|
@ -144,7 +164,13 @@
|
||||||
name: '{{ dump_file1 }}'
|
name: '{{ dump_file1 }}'
|
||||||
state: file
|
state: file
|
||||||
|
|
||||||
- name: state dump with multiple databases in list form via check_mode
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Dump and Import | State dump with multiple databases in list form via check_mode
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
login_password: '{{ mysql_password }}'
|
login_password: '{{ mysql_password }}'
|
||||||
|
@ -155,6 +181,10 @@
|
||||||
- '{{ db_name2 }}'
|
- '{{ db_name2 }}'
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ dump_file2 }}'
|
target: '{{ dump_file2 }}'
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_result
|
register: dump_result
|
||||||
check_mode: yes
|
check_mode: yes
|
||||||
|
|
||||||
|
@ -173,7 +203,13 @@
|
||||||
that:
|
that:
|
||||||
- stat_result.stat.exists is defined and not stat_result.stat.exists
|
- stat_result.stat.exists is defined and not stat_result.stat.exists
|
||||||
|
|
||||||
- name: state dump with multiple databases in list form.
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Dump and Import | State dump with multiple databases in list form.
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
login_password: '{{ mysql_password }}'
|
login_password: '{{ mysql_password }}'
|
||||||
|
@ -184,6 +220,10 @@
|
||||||
- '{{ db_name2 }}'
|
- '{{ db_name2 }}'
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ dump_file2 }}'
|
target: '{{ dump_file2 }}'
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: dump_result2
|
register: dump_result2
|
||||||
|
|
||||||
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in list form)
|
- name: Dump and Import | Assert successful completion of dump operation (with multiple databases in list form)
|
||||||
|
@ -323,7 +363,13 @@
|
||||||
that:
|
that:
|
||||||
- "'{{ db_name2 }}' in mysql_result.stdout"
|
- "'{{ db_name2 }}' in mysql_result.stdout"
|
||||||
|
|
||||||
- name: test state=dump to backup the database of type {{ format_type }} (expect changed=true)
|
# With MySQL 8, new options have been added. For instance, when attempt to dump
|
||||||
|
# a MySQL 5.7 instance, mysqldump will throw "Unknown table 'COLUMN_STATISTICS'
|
||||||
|
# in information_schema (1109)".
|
||||||
|
# Unfortunatly, the mysql-client-5.7 is unavailable on Ubuntu for multiple
|
||||||
|
# major relase :( So I add --column-statistics=0 as a workaround...
|
||||||
|
# TODO : Remove this option in octobre 2023 when MySQL 5.7 will be End of Life.
|
||||||
|
- name: Dump and Import | Test state=dump to backup the database of type {{ format_type }} (expect changed=true)
|
||||||
mysql_db:
|
mysql_db:
|
||||||
login_user: '{{ mysql_user }}'
|
login_user: '{{ mysql_user }}'
|
||||||
login_password: '{{ mysql_password }}'
|
login_password: '{{ mysql_password }}'
|
||||||
|
@ -332,6 +378,10 @@
|
||||||
name: '{{ db_name }}'
|
name: '{{ db_name }}'
|
||||||
state: dump
|
state: dump
|
||||||
target: '{{ db_file_name }}'
|
target: '{{ db_file_name }}'
|
||||||
|
dump_extra_args: >-
|
||||||
|
{% if db_engine == 'mysql' %}
|
||||||
|
--column-statistics=0
|
||||||
|
{% endif %}
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Dump and Import | Assert output message backup the database
|
- name: Dump and Import | Assert output message backup the database
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue