🚨 Fix modernized linter
parent
28305720f7
commit
4be27557c7
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
|
||||
- name: restart mariadb
|
||||
- name: Restart mariadb
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
state: restarted
|
||||
|
|
|
@ -5,9 +5,9 @@ galaxy_info:
|
|||
role_name: mysql
|
||||
author: Emilien Mantel
|
||||
description: Install and configure MariaDB (and Galera Cluster) on Debian
|
||||
company:
|
||||
company: TripleStack
|
||||
license: GPLv2
|
||||
min_ansible_version: 2.11
|
||||
min_ansible_version: '2.11'
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
path: "{{ __mark }}"
|
||||
register: s
|
||||
|
||||
- block:
|
||||
- name: COMMAND | Setup galera cluster
|
||||
when: not s.stat.exists or mariadb_galera_resetup
|
||||
block:
|
||||
- name: SET_FACT | We must NOT restart after bootstrap!
|
||||
ansible.builtin.set_fact:
|
||||
mariadb_notify_restart: false
|
||||
|
@ -21,6 +23,7 @@
|
|||
- name: COMMAND | Bootstrap first node (systemd)
|
||||
ansible.builtin.command: galera_new_cluster
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
changed_when: true
|
||||
|
||||
- name: SERVICE | Bootstrap first node (clean init)
|
||||
ansible.builtin.service:
|
||||
|
@ -30,8 +33,6 @@
|
|||
register: bootstrap_run
|
||||
when: ansible_service_mgr != 'systemd'
|
||||
|
||||
when: not s.stat.exists or mariadb_galera_resetup
|
||||
|
||||
- name: COMMAND | Create Bootstrap mark
|
||||
ansible.builtin.command: "touch {{ __mark }}"
|
||||
args:
|
||||
|
|
|
@ -11,25 +11,25 @@
|
|||
register: ondc
|
||||
changed_when: false
|
||||
|
||||
- block:
|
||||
|
||||
- name: SERVICE | Stop MariaDB
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
state: stopped
|
||||
|
||||
- name: COPY | Paste primary node's debian.cnf
|
||||
ansible.builtin.copy:
|
||||
content: "{{ debiancnf.stdout }}"
|
||||
dest: /etc/mysql/debian.cnf
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: root
|
||||
register: paste
|
||||
|
||||
- name: SERVICE | Start MariaDB
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
state: started
|
||||
|
||||
- name: BLOCK | Compare debian.cnf
|
||||
when: debiancnf.stdout != ondc.stdout
|
||||
block:
|
||||
|
||||
- name: SERVICE | Stop MariaDB
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
state: stopped
|
||||
|
||||
- name: COPY | Paste primary node's debian.cnf
|
||||
ansible.builtin.copy:
|
||||
content: "{{ debiancnf.stdout }}"
|
||||
dest: /etc/mysql/debian.cnf
|
||||
mode: 0600
|
||||
owner: root
|
||||
group: root
|
||||
register: paste
|
||||
|
||||
- name: SERVICE | Start MariaDB
|
||||
ansible.builtin.service:
|
||||
name: "{{ mariadb_service_name }}"
|
||||
state: started
|
||||
|
|
|
@ -4,13 +4,15 @@
|
|||
ansible.builtin.apt:
|
||||
name: gpg
|
||||
|
||||
- name: COMMAND | Check indempotent
|
||||
- name: COMMAND | Check expected mariadb version
|
||||
ansible.builtin.command: 'grep -q "{{ mariadb_upstream_version }}" /etc/apt/sources.list.d/mariadb.list'
|
||||
register: check_idempotent
|
||||
register: check_version
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- block:
|
||||
- name: APT | Add MariaDB upstream repository
|
||||
when: check_version.rc > 0
|
||||
block:
|
||||
|
||||
- name: GET_URL | Download MariaDB setup script
|
||||
ansible.builtin.get_url:
|
||||
|
@ -28,12 +30,3 @@
|
|||
ansible.builtin.file:
|
||||
path: '/tmp/mariadb_repo_setup'
|
||||
state: absent
|
||||
|
||||
when: check_idempotent.rc > 0
|
||||
|
||||
- name: SHELL | Remove useless old files
|
||||
ansible.builtin.shell: 'rm -f /etc/apt/sources.list.d/mariadb.list.old_*'
|
||||
args:
|
||||
removes: /etc/apt/sources.list.d/mariadb.list.old_1
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
|
|
@ -7,4 +7,4 @@
|
|||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart mariadb
|
||||
notify: Restart mariadb
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
notify: restart mariadb
|
||||
notify: Restart mariadb
|
||||
|
||||
- name: MYSQL_REPLICATION | Get slave status
|
||||
community.mysql.mysql_replication:
|
||||
mode: getslave
|
||||
mode: getreplica
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
ignore_errors: true
|
||||
register: slave_status
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
- name: MYSQL_REPLICATION | Get slave status
|
||||
community.mysql.mysql_replication:
|
||||
mode: getslave
|
||||
mode: getreplica
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
ignore_errors: true
|
||||
register: slave_status
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
mode: 0700
|
||||
|
||||
- name: OPENSSH_KEYPAIR | Create SSH key
|
||||
openssh_keypair:
|
||||
community.crypto.openssh_keypair:
|
||||
path: "{{ ansible_env.HOME }}/.ssh/id_rsa"
|
||||
register: gen_ssh
|
||||
|
||||
- block:
|
||||
- name: BLOCK | Prepare backup
|
||||
delegate_to: "{{ mariadb_slave_import_from }}"
|
||||
block:
|
||||
|
||||
- name: AUTHORIZED_KEY | Auth slave to backup host
|
||||
ansible.posix.authorized_key:
|
||||
|
@ -33,14 +35,12 @@
|
|||
creates: "{{ mariadb_backup_dir }}/xtrabackup_info"
|
||||
register: backup
|
||||
|
||||
- name: COMMAND | Dump
|
||||
- name: COMMAND | Dump # noqa: no-handler
|
||||
ansible.builtin.command: "mariabackup --prepare --target-dir={{ mariadb_backup_dir }}"
|
||||
when: backup.changed
|
||||
register: prep
|
||||
changed_when: "'This target seems to be not prepared yet' in prep.stderr"
|
||||
|
||||
delegate_to: "{{ mariadb_slave_import_from }}"
|
||||
|
||||
- name: MYSQL_VARIABLES | Get datadir
|
||||
community.mysql.mysql_variables:
|
||||
variable: datadir
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
|
||||
- name: MYSQL_REPLICATION | Stop slave
|
||||
mysql_replication:
|
||||
community.mysql.mysql_replication:
|
||||
mode: stopslave
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
||||
- name: MYSQL_REPLICATION | Configure master host
|
||||
mysql_replication:
|
||||
community.mysql.mysql_replication:
|
||||
mode: changemaster
|
||||
master_host: "{{ mariadb_replication_host }}"
|
||||
master_port: "{{ mariadb_replication_port }}"
|
||||
|
@ -16,7 +16,7 @@
|
|||
no_log: "{{ not mariadb_debug_role }}"
|
||||
|
||||
- name: MYSQL_REPLICATION | Change master
|
||||
mysql_replication:
|
||||
community.mysql.mysql_replication:
|
||||
mode: changemaster
|
||||
master_log_file: "{{ mariadb_master_log_file }}"
|
||||
master_log_pos: "{{ mariadb_master_log_pos }}"
|
||||
|
@ -24,6 +24,6 @@
|
|||
when: mariadb_master_log_file is defined and mariadb_master_log_pos is defined
|
||||
|
||||
- name: MYSQL_REPLICATION | Start slave
|
||||
mysql_replication:
|
||||
community.mysql.mysql_replication:
|
||||
mode: startslave
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: MYSQL_USER | Remove all anonymous users
|
||||
mysql_user:
|
||||
community.mysql.mysql_user:
|
||||
name: ''
|
||||
host: "{{ item }}"
|
||||
state: absent
|
||||
|
@ -13,7 +13,7 @@
|
|||
- localhost
|
||||
|
||||
- name: MYSQL_DB | Remove the test database
|
||||
mysql_db:
|
||||
community.mysql.mysql_db:
|
||||
name: test
|
||||
state: absent
|
||||
login_unix_socket: "{{ mariadb_socket }}"
|
||||
|
|
Loading…
Reference in New Issue