Replace community.mysql with ansible.mariadb collection
community.mysql 6.0.0 drops MariaDB support (#71), so switch the role to the MariaDB Foundation's ansible.mariadb collection: mysql_user/mysql_db/mysql_replication become mariadb_user/mariadb_db/mariadb_replication in tasks/, and community.mysql -> ansible.mariadb in requirements.yml (+ README links). ansible.mariadb is a fork of community.mysql: same PyMySQL driver (vars/* package installs unchanged) and identical module parameters, replication modes (getreplica/changeprimary/resetreplica/startreplica), primary_use_gtid choices, and Is_Replica/Slave_IO_Running return keys - so task logic is unchanged.
This commit is contained in:
parent
c10f482f9c
commit
f86f4741ca
|
|
@ -16,16 +16,16 @@ Optionally, this role also permits one to:
|
|||
## Requirements
|
||||
|
||||
The role uses
|
||||
[`community.mysql.mysql_user`](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_user_module.html)
|
||||
[`ansible.mariadb.mariadb_user`](https://github.com/ansible-collections/ansible.mariadb/blob/main/plugins/modules/mariadb_user.py)
|
||||
and
|
||||
[`community.mysql.mysql_db`](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_db_module.html)
|
||||
[`ansible.mariadb.mariadb_db`](https://github.com/ansible-collections/ansible.mariadb/blob/main/plugins/modules/mariadb_db.py)
|
||||
ansible modules that depend on [PyMySQL](https://github.com/PyMySQL/PyMySQL).
|
||||
Only Python 3.X versions are supported and tested. Python 2.7 is probably
|
||||
working but not tested.
|
||||
|
||||
If you need to deploy a cluster then you need Ansible 2.12+ since there was a
|
||||
change in the
|
||||
[`community.mysql.mysql_replication`](https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_replication_module.html)
|
||||
[`ansible.mariadb.mariadb_replication`](https://github.com/ansible-collections/ansible.mariadb/blob/main/plugins/modules/mariadb_replication.py)
|
||||
naming for cluster node (primary/replica is now preferred).
|
||||
|
||||
### pre-commit
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
collections:
|
||||
- name: community.general
|
||||
- name: community.mysql
|
||||
- name: ansible.mariadb
|
||||
- name: containers.podman
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Ensure MariaDB databases are present (or absent)
|
||||
community.mysql.mysql_db:
|
||||
ansible.mariadb.mariadb_db:
|
||||
name: "{{ item.name }}"
|
||||
collation: "{{ item.collation | default('utf8_general_ci') }}"
|
||||
encoding: "{{ item.encoding | default('utf8') }}"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Ensure replication user exists on primary node
|
||||
community.mysql.mysql_user:
|
||||
ansible.mariadb.mariadb_user:
|
||||
name: "{{ item.name }}"
|
||||
host: "{{ item.host | default('%') }}"
|
||||
password: "{{ item.password }}"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Check replica replication status
|
||||
community.mysql.mysql_replication:
|
||||
ansible.mariadb.mariadb_replication:
|
||||
mode: getreplica
|
||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||
register: replica
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
# no_log: true
|
||||
|
||||
- name: Configure replication on the replica
|
||||
community.mysql.mysql_replication:
|
||||
ansible.mariadb.mariadb_replication:
|
||||
mode: changeprimary
|
||||
primary_host: "{{ mariadb_replication_primary_ip }}"
|
||||
primary_user: "{{ item.name }}"
|
||||
|
|
@ -31,21 +31,21 @@
|
|||
no_log: true
|
||||
|
||||
- name: Reset replica replication
|
||||
community.mysql.mysql_replication:
|
||||
ansible.mariadb.mariadb_replication:
|
||||
mode: resetreplica
|
||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||
when:
|
||||
- not replica.Is_Replica
|
||||
|
||||
- name: Check replica replication status (second time)
|
||||
community.mysql.mysql_replication:
|
||||
ansible.mariadb.mariadb_replication:
|
||||
mode: getreplica
|
||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||
register: replica2
|
||||
no_log: true
|
||||
|
||||
- name: Start replica replication
|
||||
community.mysql.mysql_replication:
|
||||
ansible.mariadb.mariadb_replication:
|
||||
mode: startreplica
|
||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||
when:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Ensure MariaDB users are present (or absent)
|
||||
community.mysql.mysql_user:
|
||||
ansible.mariadb.mariadb_user:
|
||||
name: "{{ item.name }}"
|
||||
host: "{{ item.host | default('localhost') }}"
|
||||
password: "{{ item.password }}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue