mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
refactor(treewide): use mariadb
commands and service instead of mysql
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
57937a3811
commit
8f3f1a48a6
@ -25,9 +25,10 @@ def install_prerequisites():
|
|||||||
@click.command(
|
@click.command(
|
||||||
"mariadb", help="Install and setup MariaDB of specified version and root password"
|
"mariadb", help="Install and setup MariaDB of specified version and root password"
|
||||||
)
|
)
|
||||||
@click.option("--mysql_root_password", "--mysql-root-password", default="")
|
@click.option("--mysql_root_password", "--mysql-root-password",
|
||||||
|
"--mariadb_root_password", "--mariadb-root-password", default="")
|
||||||
@click.option("--version", default="10.3")
|
@click.option("--version", default="10.3")
|
||||||
def install_maridb(mysql_root_password, version):
|
def install_mariadb(mysql_root_password, version):
|
||||||
if mysql_root_password:
|
if mysql_root_password:
|
||||||
extra_vars.update(
|
extra_vars.update(
|
||||||
{
|
{
|
||||||
@ -111,7 +112,7 @@ def install_failtoban(**kwargs):
|
|||||||
|
|
||||||
|
|
||||||
install.add_command(install_prerequisites)
|
install.add_command(install_prerequisites)
|
||||||
install.add_command(install_maridb)
|
install.add_command(install_mariadb)
|
||||||
install.add_command(install_wkhtmltopdf)
|
install.add_command(install_wkhtmltopdf)
|
||||||
install.add_command(install_nodejs)
|
install.add_command(install_nodejs)
|
||||||
install.add_command(install_psutil)
|
install.add_command(install_psutil)
|
||||||
|
@ -358,7 +358,7 @@ def sync_domains(domain=None, site=None):
|
|||||||
@click.command("role", help="Install dependencies via ansible roles")
|
@click.command("role", help="Install dependencies via ansible roles")
|
||||||
@click.argument("role")
|
@click.argument("role")
|
||||||
@click.option("--admin_emails", default="")
|
@click.option("--admin_emails", default="")
|
||||||
@click.option("--mysql_root_password")
|
@click.option("--mysql_root_password", "--mariadb_root_password")
|
||||||
@click.option("--container", is_flag=True, default=False)
|
@click.option("--container", is_flag=True, default=False)
|
||||||
def setup_roles(role, **kwargs):
|
def setup_roles(role, **kwargs):
|
||||||
extra_vars = {"production": True}
|
extra_vars = {"production": True}
|
||||||
|
@ -13,7 +13,7 @@ Debain 9
|
|||||||
|
|
||||||
## Post install
|
## Post install
|
||||||
|
|
||||||
Run `mysql_secure_installation`
|
Run `mariadb-secure-installation`
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ Configuration filename:
|
|||||||
mysql_conf_file: settings.cnf
|
mysql_conf_file: settings.cnf
|
||||||
```
|
```
|
||||||
|
|
||||||
### Experimental unattended mysql_secure_installation
|
### Experimental unattended mariadb-secure-installation
|
||||||
|
|
||||||
```
|
```
|
||||||
ansible-playbook release.yml --extra-vars "mysql_secure_installation=true mysql_root_password=your_very_secret_password"
|
ansible-playbook release.yml --extra-vars "mysql_secure_installation=true mysql_root_password=your_very_secret_password"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
---
|
---
|
||||||
- name: restart mysql
|
- name: restart mariadb
|
||||||
service: name=mysql state=restarted
|
service: name=mariadb state=restarted
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: mysql_conf_tpl != 'change_me' and ansible_distribution != 'Debian'
|
when: mysql_conf_tpl != 'change_me' and ansible_distribution != 'Debian'
|
||||||
notify: restart mysql
|
notify: restart mariadb
|
||||||
|
|
||||||
- include_tasks: debian.yml
|
- include_tasks: debian.yml
|
||||||
when: ansible_distribution == 'Debian'
|
when: ansible_distribution == 'Debian'
|
||||||
@ -29,7 +29,7 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: mysql_conf_tpl != 'change_me' and ansible_distribution == 'Debian'
|
when: mysql_conf_tpl != 'change_me' and ansible_distribution == 'Debian'
|
||||||
notify: restart mysql
|
notify: restart mariadb
|
||||||
|
|
||||||
- name: Add additional conf for MariaDB 10.2 in mariadb.conf.d
|
- name: Add additional conf for MariaDB 10.2 in mariadb.conf.d
|
||||||
blockinfile:
|
blockinfile:
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
- name: Start and enable service
|
- name: Start and enable service
|
||||||
service:
|
service:
|
||||||
name: mysql
|
name: mariadb
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
|
@ -19,28 +19,28 @@
|
|||||||
- ::1
|
- ::1
|
||||||
|
|
||||||
- name: Reload privilege tables
|
- name: Reload privilege tables
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mariadb -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- FLUSH PRIVILEGES
|
- FLUSH PRIVILEGES
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
|
|
||||||
- name: Remove anonymous users
|
- name: Remove anonymous users
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mariadb -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- DELETE FROM mysql.user WHERE User=''
|
- DELETE FROM mysql.user WHERE User=''
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
|
|
||||||
- name: Disallow root login remotely
|
- name: Disallow root login remotely
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mariadb -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
|
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
|
|
||||||
- name: Remove test database and access to it
|
- name: Remove test database and access to it
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mariadb -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- DROP DATABASE IF EXISTS test
|
- DROP DATABASE IF EXISTS test
|
||||||
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
|
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'
|
||||||
@ -48,7 +48,7 @@
|
|||||||
when: run_travis is not defined
|
when: run_travis is not defined
|
||||||
|
|
||||||
- name: Reload privilege tables
|
- name: Reload privilege tables
|
||||||
command: 'mysql -ne "{{ item }}"'
|
command: 'mariadb -ne "{{ item }}"'
|
||||||
with_items:
|
with_items:
|
||||||
- FLUSH PRIVILEGES
|
- FLUSH PRIVILEGES
|
||||||
changed_when: False
|
changed_when: False
|
||||||
|
Loading…
Reference in New Issue
Block a user