diff --git a/tests/integration/targets/setup_mysql/tasks/setvars.yml b/tests/integration/targets/setup_mysql/tasks/setvars.yml index 4a885a8..9ea9eb7 100644 --- a/tests/integration/targets/setup_mysql/tasks/setvars.yml +++ b/tests/integration/targets/setup_mysql/tasks/setvars.yml @@ -15,13 +15,19 @@ - name: "{{ role_name }} | setvars | Set Fact using above facts" ansible.builtin.set_fact: connector_ver: "{{ connector_name.split('=')[2].strip() }}" - mysql_command: > + mysql_command: >- mysql -h{{ gateway_addr }} -P{{ mysql_primary_port }} -u{{ mysql_user }} -p{{ mysql_password }} --protocol=tcp + mysql_command_wo_port: >- + mysql + -h{{ gateway_addr }} + -u{{ mysql_user }} + -p{{ mysql_password }} + --protocol=tcp - name: "{{ role_name }} | setvars | Debug connector info" ansible.builtin.debug: diff --git a/tests/integration/targets/test_mysql_replication/tasks/issue-265.yml b/tests/integration/targets/test_mysql_replication/tasks/issue-265.yml index 64e59a9..9a04c78 100644 --- a/tests/integration/targets/test_mysql_replication/tasks/issue-265.yml +++ b/tests/integration/targets/test_mysql_replication/tasks/issue-265.yml @@ -26,6 +26,7 @@ mysql_user: <<: *mysql_params name: '{{ user_name_1 }}' + host: '{{ gateway_addr }}' state: absent ignore_errors: yes @@ -35,6 +36,7 @@ mysql_user: <<: *mysql_params name: "{{ user_name_1 }}" + host: '{{ gateway_addr }}' password: "{{ user_password_1 }}" priv: '*.*:ALL,GRANT' force_context: yes @@ -57,6 +59,7 @@ mysql_user: <<: *mysql_params name: '{{ user_name_1 }}' + host: '{{ gateway_addr }}' state: absent force_context: yes @@ -89,11 +92,11 @@ - result.queries == ["STOP SLAVE"] or result.queries == ["STOP REPLICA"] - name: Create replication filter MySQL - shell: "echo \"CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB = (mysql);\" | {{ mysql_command }} -P{{ mysql_replica1_port }}" + shell: "echo \"CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB = (mysql);\" | {{ mysql_command_wo_port }} -P{{ mysql_replica1_port }}" when: db_engine == 'mysql' - name: Create replication filter MariaDB - shell: "echo \"SET GLOBAL replicate_ignore_db = 'mysql';\" | {{ mysql_command }} -P{{ mysql_replica1_port }}" + shell: "echo \"SET GLOBAL replicate_ignore_db = 'mysql';\" | {{ mysql_command_wo_port }} -P{{ mysql_replica1_port }}" when: db_engine == 'mariadb' - name: Start replica @@ -114,6 +117,7 @@ mysql_user: <<: *mysql_params name: "{{ user_name_1 }}" + host: "{{ gateway_addr }}" password: "{{ user_password_1 }}" priv: '*.*:ALL,GRANT' force_context: yes @@ -136,6 +140,7 @@ mysql_user: <<: *mysql_params name: '{{ user_name_1 }}' + host: "{{ gateway_addr }}" state: absent force_context: yes @@ -154,9 +159,9 @@ - result.queries == ["STOP SLAVE"] or result.queries == ["STOP REPLICA"] - name: Remove replication filter MySQL - shell: "echo \"CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB = ();\" | {{ mysql_command }} -P{{ mysql_replica1_port }}" + shell: "echo \"CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB = ();\" | {{ mysql_command_wo_port }} -P{{ mysql_replica1_port }}" when: db_engine == 'mysql' - name: Remove replication filter MariaDB - shell: "echo \"SET GLOBAL replicate_ignore_db = '';\" | {{ mysql_command }} -P{{ mysql_replica1_port }}" + shell: "echo \"SET GLOBAL replicate_ignore_db = '';\" | {{ mysql_command_wo_port }} -P{{ mysql_replica1_port }}" when: db_engine == 'mariadb' diff --git a/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml b/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml index 4f73d42..4e1c8cd 100644 --- a/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml +++ b/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml @@ -26,17 +26,14 @@ - db.version.major > 8 or (db.version.major == 8 and db.version.minor > 0) or (db.version.major == 8 and db.version.minor == 0 and db.version.release >= 22) - db_engine == 'mysql' - - name: alias mysql command to include default options except for the port - set_fact: - mysql_command_wo_port: "mysql -u{{ mysql_user }} -p{{ mysql_password }} --protocol=tcp -h{{ gateway_addr }}" # Preparation: - name: Create user for mysql replication - shell: "echo \"CREATE USER '{{ replication_user }}'@'localhost' IDENTIFIED WITH mysql_native_password BY '{{ replication_pass }}'; GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'localhost';\" | {{ mysql_command_wo_port }} -P{{ mysql_primary_port }}" + shell: "echo \"CREATE USER '{{ replication_user }}'@'{{ gateway_addr }}' IDENTIFIED WITH mysql_native_password BY '{{ replication_pass }}'; GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'{{ gateway_addr }}';\" | {{ mysql_command }}" when: db_engine == 'mysql' - name: Create user for mariadb replication - shell: "echo \"CREATE USER '{{ replication_user }}'@'localhost' IDENTIFIED BY '{{ replication_pass }}'; GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'localhost';\" | {{ mysql_command_wo_port }} -P{{ mysql_primary_port }}" + shell: "echo \"CREATE USER '{{ replication_user }}'@'{{ gateway_addr }}' IDENTIFIED BY '{{ replication_pass }}'; GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'{{ gateway_addr }}';\" | {{ mysql_command }}" when: db_engine == 'mariadb' - name: Create test database