mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-30 08:31:29 -07:00
Add same variables as other target for consistency
This commit is contained in:
parent
3f64fb5f32
commit
0b6569d55a
4 changed files with 41 additions and 39 deletions
|
@ -3,11 +3,11 @@
|
|||
|
||||
# Preparation:
|
||||
- name: Create user for replication
|
||||
shell: "echo \"GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'localhost' IDENTIFIED BY '{{ replication_pass }}'; FLUSH PRIVILEGES;\" | mysql -P {{ primary_db.port }} -h '{{ gateway_addr }}'"
|
||||
shell: "echo \"GRANT REPLICATION SLAVE ON *.* TO '{{ replication_user }}'@'localhost' IDENTIFIED BY '{{ replication_pass }}'; FLUSH PRIVILEGES;\" | mysql -P {{ primary_db.port }} -h '{{ mysql_host }}'"
|
||||
|
||||
- name: Create test database
|
||||
mysql_db:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: '{{ primary_db.port }}'
|
||||
state: present
|
||||
name: '{{ test_db }}'
|
||||
|
@ -16,12 +16,12 @@
|
|||
shell: 'mysqldump -P {{ primary_db.port }} -h 127.0.01 --all-databases --master-data=2 > {{ dump_path }}'
|
||||
|
||||
- name: Restore the dump to the replica
|
||||
shell: 'mysql -P {{ replica_db.port }} -h '{{ gateway_addr }}' < {{ dump_path }}'
|
||||
shell: "mysql -P {{ replica_db.port }} -h '{{ mysql_host }}' < {{ dump_path }}"
|
||||
|
||||
# Test getmaster mode:
|
||||
- name: Get master status
|
||||
mysql_replication:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: "{{ primary_db.port }}"
|
||||
mode: getmaster
|
||||
register: master_status
|
||||
|
@ -35,10 +35,10 @@
|
|||
# Test changemaster mode:
|
||||
- name: Run replication
|
||||
mysql_replication:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: "{{ replica_db.port }}"
|
||||
mode: changemaster
|
||||
master_host: '{{ gateway_addr }}'
|
||||
master_host: '{{ mysql_host }}'
|
||||
master_port: "{{ primary_db.port }}"
|
||||
master_user: "{{ replication_user }}"
|
||||
master_password: "{{ replication_pass }}"
|
||||
|
@ -54,7 +54,7 @@
|
|||
# Test startslave mode:
|
||||
- name: Start slave
|
||||
mysql_replication:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: "{{ replica_db.port }}"
|
||||
mode: startslave
|
||||
register: result
|
||||
|
@ -67,7 +67,7 @@
|
|||
# Test getslave mode:
|
||||
- name: Get replica status
|
||||
mysql_replication:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: "{{ replica_db.port }}"
|
||||
mode: getslave
|
||||
register: slave_status
|
||||
|
@ -75,7 +75,7 @@
|
|||
- assert:
|
||||
that:
|
||||
- slave_status.Is_Slave == true
|
||||
- slave_status.Master_Host == ''{{ gateway_addr }}''
|
||||
- slave_status.Master_Host == ''{{ mysql_host }}''
|
||||
- slave_status.Exec_Master_Log_Pos == master_status.Position
|
||||
- slave_status.Master_Port == {{ primary_db.port }}
|
||||
- slave_status.Last_IO_Errno == 0
|
||||
|
@ -85,7 +85,7 @@
|
|||
# Test stopslave mode:
|
||||
- name: Stop slave
|
||||
mysql_replication:
|
||||
login_host: '{{ gateway_addr }}'
|
||||
login_host: '{{ mysql_host }}'
|
||||
login_port: "{{ replica_db.port }}"
|
||||
mode: stopslave
|
||||
register: result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue