commit
f8b572e657
38
README.md
38
README.md
|
|
@ -37,8 +37,8 @@ Available variables are listed below, along with default values (see
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mariadb_use_official_repo: false
|
mariadb_use_official_repo: false
|
||||||
mariadb_use_official_repo_url: "http://ftp.igh.cnrs.fr/pub/mariadb/repo"
|
mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo
|
||||||
mariadb_use_official_repo_version: "10.4"
|
mariadb_use_official_repo_version: 10.4
|
||||||
```
|
```
|
||||||
|
|
||||||
You may deploy the MariaDB Server version that comes with your distribution (Debian/Ubuntu) or
|
You may deploy the MariaDB Server version that comes with your distribution (Debian/Ubuntu) or
|
||||||
|
|
@ -71,11 +71,11 @@ Foundation package and it should be easy to change them all (see
|
||||||
#### Basic settings
|
#### Basic settings
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mariadb_config_file: "/etc/mysql/my.cnf"
|
mariadb_config_file: /etc/mysql/my.cnf
|
||||||
mariadb_datadir: "/var/lib/mysql"
|
mariadb_datadir: /var/lib/mysql
|
||||||
mariadb_port: "3306"
|
mariadb_port: 3306
|
||||||
mariadb_bind_address: "127.0.0.1"
|
mariadb_bind_address: 127.0.0.1
|
||||||
mariadb_unix_socket: "/run/mysqld/mysqld.sock"
|
mariadb_unix_socket: /run/mysqld/mysqld.sock
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
@ -199,19 +199,19 @@ mariadb_replication_user: []
|
||||||
#### Master variables
|
#### Master variables
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mariadb_replication_role: "master"
|
mariadb_replication_role: master
|
||||||
mariadb_server_id: "1"
|
mariadb_server_id: 1
|
||||||
mariadb_max_binlog_size: "100M"
|
mariadb_max_binlog_size: 100M
|
||||||
mariadb_binlog_format: "MIXED"
|
mariadb_binlog_format: MIXED
|
||||||
mariadb_expire_logs_days: "10"
|
mariadb_expire_logs_days: 10
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Replica variables
|
#### Replica variables
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mariadb_replication_role: "replica"
|
mariadb_replication_role: replica
|
||||||
mariadb_server_id: "1"
|
mariadb_server_id: 1
|
||||||
mariadb_replication_master_ip: "IP"
|
mariadb_replication_master_ip: IP
|
||||||
```
|
```
|
||||||
|
|
||||||
### Backups (optional)
|
### Backups (optional)
|
||||||
|
|
@ -219,10 +219,10 @@ mariadb_replication_master_ip: "IP"
|
||||||
```yaml
|
```yaml
|
||||||
# db dumps backup
|
# db dumps backup
|
||||||
mariadb_backup_db: false
|
mariadb_backup_db: false
|
||||||
mariadb_backup_db_cron_min: "50"
|
mariadb_backup_db_cron_min: 50
|
||||||
mariadb_backup_db_cron_hour: "00"
|
mariadb_backup_db_cron_hour: 00
|
||||||
mariadb_backup_db_dir: "/mnt/backup"
|
mariadb_backup_db_dir: /mnt/backup
|
||||||
mariadb_backup_db_rotation: "15"
|
mariadb_backup_db_rotation: 15
|
||||||
|
|
||||||
# name of the database to dump
|
# name of the database to dump
|
||||||
# (mandatory if mariadb_backup_db is set to true)
|
# (mandatory if mariadb_backup_db is set to true)
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
# Configure the following to use official MariaDB repository
|
# Configure the following to use official MariaDB repository
|
||||||
# see: https://downloads.mariadb.org/mariadb/repositories
|
# see: https://downloads.mariadb.org/mariadb/repositories
|
||||||
mariadb_use_official_repo: false
|
mariadb_use_official_repo: false
|
||||||
mariadb_use_official_repo_url: "http://ftp.igh.cnrs.fr/pub/mariadb/repo"
|
mariadb_use_official_repo_url: http://ftp.igh.cnrs.fr/pub/mariadb/repo
|
||||||
mariadb_use_official_repo_version: "10.4"
|
mariadb_use_official_repo_version: 10.4
|
||||||
|
|
||||||
mariadb_enabled_on_startup: true
|
mariadb_enabled_on_startup: true
|
||||||
# The following is set to true by default but you may consider setting it to
|
# The following is set to true by default but you may consider setting it to
|
||||||
|
|
@ -16,10 +16,10 @@ mariadb_overwrite_global_config_file: true
|
||||||
# MariaDB configuration file
|
# MariaDB configuration file
|
||||||
mariadb_config_file: /etc/mysql/my.cnf
|
mariadb_config_file: /etc/mysql/my.cnf
|
||||||
# Basic settings
|
# Basic settings
|
||||||
mariadb_datadir: "/var/lib/mysql"
|
mariadb_datadir: /var/lib/mysql
|
||||||
mariadb_port: "3306"
|
mariadb_port: 3306
|
||||||
mariadb_bind_address: "127.0.0.1"
|
mariadb_bind_address: 127.0.0.1
|
||||||
mariadb_unix_socket: "/run/mysqld/mysqld.sock"
|
mariadb_unix_socket: /run/mysqld/mysqld.sock
|
||||||
mariadb_basic_settings_raw: |
|
mariadb_basic_settings_raw: |
|
||||||
user = mysql
|
user = mysql
|
||||||
pid-file = /run/mysqld/mysqld.pid
|
pid-file = /run/mysqld/mysqld.pid
|
||||||
|
|
@ -86,11 +86,11 @@ mariadb_users: []
|
||||||
|
|
||||||
# Replication
|
# Replication
|
||||||
# replication is only enabled if mariadb_replication_role has values
|
# replication is only enabled if mariadb_replication_role has values
|
||||||
mariadb_replication_role: "" # master|replica
|
mariadb_replication_role: ""
|
||||||
mariadb_replication_master_ip: ""
|
mariadb_replication_master_ip: ""
|
||||||
mariadb_max_binlog_size: "100M"
|
mariadb_max_binlog_size: 100M
|
||||||
mariadb_binlog_format: "MIXED"
|
mariadb_binlog_format: MIXED
|
||||||
mariadb_expire_logs_days: "10"
|
mariadb_expire_logs_days: 10
|
||||||
|
|
||||||
# Replication users
|
# Replication users
|
||||||
# same keys as mariadb_users above
|
# same keys as mariadb_users above
|
||||||
|
|
@ -99,10 +99,10 @@ mariadb_replication_user: []
|
||||||
|
|
||||||
# Backups
|
# Backups
|
||||||
mariadb_backup_db: false
|
mariadb_backup_db: false
|
||||||
mariadb_backup_db_cron_min: "50"
|
mariadb_backup_db_cron_min: 50
|
||||||
mariadb_backup_db_cron_hour: "00"
|
mariadb_backup_db_cron_hour: 00
|
||||||
mariadb_backup_db_dir: "/opt/backup"
|
mariadb_backup_db_dir: /opt/backup
|
||||||
mariadb_backup_db_rotation: "15"
|
mariadb_backup_db_rotation: 15
|
||||||
|
|
||||||
# DB to backup
|
# DB to backup
|
||||||
mariadb_backup_db_name: []
|
mariadb_backup_db_name: []
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ galaxy_info:
|
||||||
author: fauust
|
author: fauust
|
||||||
role_name: mariadb
|
role_name: mariadb
|
||||||
description: MariaDB server for Debian/Ubuntu.
|
description: MariaDB server for Debian/Ubuntu.
|
||||||
license: "license GPL-3.0-only"
|
license: license GPL-3.0-only
|
||||||
min_ansible_version: 2.8
|
min_ansible_version: 2.8
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,5 @@
|
||||||
state: started
|
state: started
|
||||||
enabled: "{{ mariadb_enabled_on_startup }}"
|
enabled: "{{ mariadb_enabled_on_startup }}"
|
||||||
|
|
||||||
# immediately restart mariadb
|
- name: Immediately restart MariaDB (necessary for replication)
|
||||||
# this is necessary for replication setup
|
meta: flush_handlers
|
||||||
- meta: flush_handlers
|
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
---
|
---
|
||||||
- name: include task setup.yml
|
- name: include task setup.yml
|
||||||
include_tasks: setup.yml
|
import_tasks: setup.yml
|
||||||
|
|
||||||
- name: include task configure.yml
|
- name: include task configure.yml
|
||||||
include_tasks: configure.yml
|
import_tasks: configure.yml
|
||||||
|
|
||||||
- name: include task databases.yml
|
- name: include task databases.yml
|
||||||
include_tasks: databases.yml
|
import_tasks: databases.yml
|
||||||
when:
|
when:
|
||||||
- mariadb_databases is defined
|
- mariadb_databases is defined
|
||||||
- mariadb_replication_role != "replica"
|
- mariadb_replication_role != "replica"
|
||||||
|
|
||||||
- name: include task users.yml
|
- name: include task users.yml
|
||||||
include_tasks: users.yml
|
import_tasks: users.yml
|
||||||
when:
|
when:
|
||||||
- mariadb_users is defined
|
- mariadb_users is defined
|
||||||
- mariadb_replication_role != "replica"
|
- mariadb_replication_role != "replica"
|
||||||
|
|
||||||
- name: include task replication_master.yml
|
- name: include task replication_master.yml
|
||||||
include_tasks: replication_master.yml
|
import_tasks: replication_master.yml
|
||||||
when: mariadb_replication_role == "master"
|
when: mariadb_replication_role == "master"
|
||||||
|
|
||||||
- name: include task replication_replica.yml
|
- name: include task replication_replica.yml
|
||||||
include_tasks: replication_replica.yml
|
import_tasks: replication_replica.yml
|
||||||
when:
|
when:
|
||||||
- not ansible_check_mode
|
- not ansible_check_mode
|
||||||
- mariadb_replication_role == "replica"
|
- mariadb_replication_role == "replica"
|
||||||
|
|
||||||
- name: include task backup.yml
|
- name: include task backup.yml
|
||||||
include_tasks: backup.yml
|
import_tasks: backup.yml
|
||||||
when: mariadb_backup_db
|
when: mariadb_backup_db
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
command: |
|
command: |
|
||||||
/usr/bin/mariadb -e "CHANGE MASTER TO master_host='{{ mariadb_replication_master_ip }}',
|
/usr/bin/mariadb -e "CHANGE MASTER TO master_host='{{ mariadb_replication_master_ip }}',
|
||||||
master_user='{{ item.name }}', master_password='{{ item.password }}', master_use_gtid=slave_pos"
|
master_user='{{ item.name }}', master_password='{{ item.password }}', master_use_gtid=slave_pos"
|
||||||
with_items: "{{ mariadb_replication_user }}"
|
loop: "{{ mariadb_replication_user }}"
|
||||||
when:
|
when:
|
||||||
- not replica.Is_Slave
|
- not replica.Is_Slave
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
# master_password: "{{ item.password }}"
|
# master_password: "{{ item.password }}"
|
||||||
# master_use_gtid: "{{ mariadb_replication_gtid | default('slave_pos') }}
|
# master_use_gtid: "{{ mariadb_replication_gtid | default('slave_pos') }}
|
||||||
# login_unix_socket: "{{ mariadb_unix_socket }}"
|
# login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||||
# with_items: "{{ mariadb_replication_user }}"
|
# loop: "{{ mariadb_replication_user }}"
|
||||||
# when:
|
# when:
|
||||||
# - not replica.Is_Slave
|
# - not replica.Is_Slave
|
||||||
# no_log: true
|
# no_log: true
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@
|
||||||
append_privs: "{{ item.append_privs | default('no') }}"
|
append_privs: "{{ item.append_privs | default('no') }}"
|
||||||
encrypted: "{{ item.encrypted | default('no') }}"
|
encrypted: "{{ item.encrypted | default('no') }}"
|
||||||
login_unix_socket: "{{ mariadb_unix_socket }}"
|
login_unix_socket: "{{ mariadb_unix_socket }}"
|
||||||
with_items: "{{ mariadb_users }}"
|
loop: "{{ mariadb_users }}"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue