Remove master namming
This commit is contained in:
parent
904a107ae1
commit
a7989e042d
4
Makefile
4
Makefile
|
|
@ -30,9 +30,9 @@ install-pre-commit: ## Install pre-commit tool
|
|||
$(info --> Install pre-commit tool via `pip3`)
|
||||
pip3 install pre-commit
|
||||
|
||||
pre-commit-run: ## Run pre-commit hooks with $PRE_COMMIT_ARGS default to (diff master...[current_branch])
|
||||
pre-commit-run: ## Run pre-commit hooks
|
||||
$(info --> run pre-commit on changed files (pre-commit run))
|
||||
pre-commit run $(PRE_COMMIT_ARGS) --color=always
|
||||
pre-commit run --color=always
|
||||
|
||||
pre-commit-run-all: ## Run pre-commit on the whole repository
|
||||
$(info --> run pre-commit on the whole repo (pre-commit run -a))
|
||||
|
|
|
|||
20
README.md
20
README.md
|
|
@ -8,7 +8,7 @@ Install and configure MariaDB Server on Debian/Ubuntu.
|
|||
|
||||
Optionally, this role also permits one to:
|
||||
|
||||
- deploy a master/replica cluster;
|
||||
- deploy a primary/replica cluster;
|
||||
- setup backups and rotation of the dumps.
|
||||
|
||||
## Requirements
|
||||
|
|
@ -214,20 +214,12 @@ See: <https://docs.ansible.com/ansible/latest/modules/mysql_user_module.html>
|
|||
|
||||
### Replication (optional)
|
||||
|
||||
Replication is only enabled if `mariadb_replication_role` has a value (`master` or
|
||||
Replication is only enabled if `mariadb_replication_role` has a value (`primary` or
|
||||
`replica`).
|
||||
|
||||
The replication setup on the replica use the GTID autopositioning
|
||||
`master_use_gtid=slave_pos`. See:
|
||||
The replication setup on the replica use the GTID autopositioning, see
|
||||
<https://mariadb.com/kb/en/library/change-master-to/#master_use_gtid>
|
||||
|
||||
For the moment, we use an `SQL` command but in ansible 2.10, we should be able
|
||||
to use the
|
||||
[`mysql_replication`](https://docs.ansible.com/ansible/latest/modules/mysql_replication_module.html)
|
||||
module (see
|
||||
[`tasks/replication_replica.yml`](./tasks/replication_replica.yml#L09-L33) and
|
||||
<https://github.com/ansible/ansible/pull/62648>).
|
||||
|
||||
#### Common vars
|
||||
|
||||
```yaml
|
||||
|
|
@ -236,10 +228,10 @@ module (see
|
|||
mariadb_replication_user: []
|
||||
```
|
||||
|
||||
#### Master variables
|
||||
#### Primary node variables
|
||||
|
||||
```yaml
|
||||
mariadb_replication_role: master
|
||||
mariadb_replication_role: primary
|
||||
mariadb_server_id: 1
|
||||
mariadb_max_binlog_size: 100M
|
||||
mariadb_binlog_format: MIXED
|
||||
|
|
@ -251,7 +243,7 @@ mariadb_expire_logs_days: 10
|
|||
```yaml
|
||||
mariadb_replication_role: replica
|
||||
mariadb_server_id: 1
|
||||
mariadb_replication_master_ip: IP
|
||||
mariadb_replication_primary_ip: IP
|
||||
```
|
||||
|
||||
### Backups (optional)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ mariadb_users: []
|
|||
# Replication
|
||||
# replication is only enabled if mariadb_replication_role has values
|
||||
mariadb_replication_role: ""
|
||||
mariadb_replication_master_ip: ""
|
||||
mariadb_replication_primary_ip: ""
|
||||
mariadb_max_binlog_size: 100M
|
||||
mariadb_binlog_format: MIXED
|
||||
mariadb_expire_logs_days: 10
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ provisioner:
|
|||
state: present
|
||||
replica:
|
||||
mariadb_replication_role: replica
|
||||
mariadb_replication_master_ip: node1
|
||||
mariadb_replication_primary_ip: node1
|
||||
host_vars:
|
||||
node1:
|
||||
mariadb_server_id: 1
|
||||
mariadb_bind_address: 0.0.0.0
|
||||
mariadb_replication_role: master
|
||||
mariadb_replication_role: primary
|
||||
mariadb_max_binlog_size: 100M
|
||||
mariadb_binlog_format: MIXED
|
||||
mariadb_expire_logs_days: 10
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
- name: Verify replication
|
||||
hosts: replica
|
||||
tasks:
|
||||
- name: Check that test db exist (created only on master)
|
||||
- name: Check that test db exist (created only on primary node)
|
||||
ansible.builtin.shell: |
|
||||
mariadb -Bse 'SHOW DATABASES' | grep -q '^{{ item }}$'
|
||||
loop:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
mariadb_server_id: 1
|
||||
mariadb_bind_address: 0.0.0.0
|
||||
mariadb_replication_role: master
|
||||
mariadb_replication_role: primary
|
||||
|
||||
mariadb_innodb_raw: |
|
||||
innodb_buffer_pool_size = 512M
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
mariadb_server_id: 1
|
||||
mariadb_bind_address: 0.0.0.0
|
||||
mariadb_replication_role: master
|
||||
mariadb_replication_role: primary
|
||||
|
||||
mariadb_innodb_raw: |
|
||||
innodb_buffer_pool_size = 512M
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
- mariadb_users is defined
|
||||
- mariadb_replication_role != "replica"
|
||||
|
||||
- name: Include task replication_master.yml
|
||||
ansible.builtin.import_tasks: replication_master.yml
|
||||
when: mariadb_replication_role == "master"
|
||||
- name: Include task replication_primary.yml
|
||||
ansible.builtin.import_tasks: replication_primary.yml
|
||||
when: mariadb_replication_role == "primary"
|
||||
|
||||
- name: Include task replication_replica.yml
|
||||
ansible.builtin.import_tasks: replication_replica.yml
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Ensure replication user exists on master
|
||||
- name: Ensure replication user exists on primary node
|
||||
community.mysql.mysql_user:
|
||||
name: "{{ item.name }}"
|
||||
host: "{{ item.host | default('%') }}"
|
||||
|
|
@ -20,10 +20,10 @@
|
|||
- name: Configure replication on the replica
|
||||
community.mysql.mysql_replication:
|
||||
mode: changeprimary
|
||||
master_host: "{{ mariadb_replication_master_ip }}"
|
||||
master_user: "{{ item.name }}"
|
||||
master_password: "{{ item.password }}"
|
||||
master_use_gtid: "{{ mariadb_replication_gtid | default('replica_pos') }}"
|
||||
primary_host: "{{ mariadb_replication_primary_ip }}"
|
||||
primary_user: "{{ item.name }}"
|
||||
primary_password: "{{ item.password }}"
|
||||
primary_use_gtid: "{{ mariadb_replication_gtid | default('replica_pos') }}"
|
||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||
loop: "{{ mariadb_replication_user }}"
|
||||
when:
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@
|
|||
server-id = {{ mariadb_server_id }}
|
||||
log-basename = mariadb
|
||||
|
||||
{% if mariadb_replication_role == 'master' %}
|
||||
{% if mariadb_replication_role == 'primary' %}
|
||||
log_bin
|
||||
expire_logs_days = {{ mariadb_expire_logs_days }}
|
||||
max_binlog_size = {{ mariadb_max_binlog_size }}
|
||||
binlog_format = {{mariadb_binlog_format}}
|
||||
# the following permits to simplify the process of moving a replica to a master
|
||||
# role by ensuring that replication is not started on master
|
||||
# the following permits to simplify the process of moving a replica to a
|
||||
# primary node role by ensuring that replication is not started on primary node
|
||||
skip-slave-start
|
||||
|
||||
{% for db in mariadb_databases %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue