https://github.com/deveryware/ansible-role-mysql-replication
https://github.com/deveryware/ansible-role-mysql-replication
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/deveryware/ansible-role-mysql-replication
- Owner: Deveryware
- License: other
- Created: 2021-04-20T12:10:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-18T14:35:03.000Z (about 2 years ago)
- Last Synced: 2025-01-09T00:11:43.621Z (over 1 year ago)
- Size: 24.4 KB
- Stars: 3
- Watchers: 7
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ansible Role: MySQL Replication
This role configures mysql or mariadb replication with GTID if possible.
## Requirements
At least two working mysql servers with binary logs enabled.
## Role Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `mysql_replication_user` | Defines the replication user | mandatory |
| `mysql_socket` | MySQL Unix domain socket used for connections | `/run/mysqld/mysqld.sock` |
| `mysql_replication_primary` | IP address or FQDN of the primary | mandatory |
| `mariadb_primary_use_gtid` | The value passed to [`primary_use_gtid`] (MariaDB only) | `slave_pos` |
### `mysql_replication_user`
This variable represents the replication user and its associated rights as a YAML dictionary using the following structure:
| Variable | Description | Default |
|----------|-------------|---------|
| `name` | Name of the replication user | mandatory |
| `host` | The 'host' part of the MySQL username | `%` |
| `password` | User's password | mandatory |
| `priv` | MySQL privileges string in the format | `*.*:REPLICATION SLAVE,REPLICATION CLIENT` |
Example:
```yaml
mysql_replication_user:
name: replication
host: 192.168.25.%
password: "{{ vault_replication_password }}"
```
## Dependencies
collection community.mysql >= 3.1.0 (included in ansible >= 6.x)
## Example of a bi-directional replication
Inventory:
```yaml
all:
children:
db:
vars:
mysql_replication_user:
name: replication
host: 192.68.25.%
password: "P@ssW0rD!"
hosts:
db1.exemple.com:
mysql_replication_primary: db2.exemple.com
db2.exemple.com:
mysql_replication_primary: db1.exemple.com
```
Playbook:
```yaml
- hosts: db
roles:
- role: ansible-role-mysql-replication
```
## License
MIT / ISC
## Contributing
To get in touch with the author you can create a issue on github when requesting features.
## Author Information
This role was created in 2021 by Olivier Pouilly on the behalf of Deveryware.