59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
|
---
|
||
|
|
||
|
- name: Install mariadb
|
||
|
apt:
|
||
|
update_cache: yes
|
||
|
pkg:
|
||
|
- mariadb-server
|
||
|
- python3-pymysql
|
||
|
state: present
|
||
|
|
||
|
- name: Enable and start mariadb
|
||
|
systemd:
|
||
|
name: mariadb.service
|
||
|
state: started
|
||
|
enabled: yes
|
||
|
|
||
|
- name: Update MariaDB root password
|
||
|
community.mysql.mysql_user:
|
||
|
name: root
|
||
|
host_all: yes
|
||
|
password: "{{ mysql_root_pwd }}"
|
||
|
login_password: "{{ mysql_root_pwd }}"
|
||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
|
||
|
- name: Removes all anonymous user accounts
|
||
|
community.mysql.mysql_user:
|
||
|
name: ''
|
||
|
host_all: yes
|
||
|
state: absent
|
||
|
login_password: "{{ mysql_root_pwd }}"
|
||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
|
||
|
- name: Remove MySQL test database
|
||
|
mysql_db:
|
||
|
name: test
|
||
|
state: absent
|
||
|
login_password: "{{ mysql_root_pwd }}"
|
||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
|
||
|
- name: Create mysql databases
|
||
|
community.mysql.mysql_db:
|
||
|
name: "{{ item.name }}"
|
||
|
state: present
|
||
|
login_password: "{{ mysql_root_pwd }}"
|
||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
loop: "{{ mysql_databases }}"
|
||
|
no_log: "{{ enable_no_log | default('true') }}"
|
||
|
|
||
|
- name: Create mysql users
|
||
|
community.mysql.mysql_user:
|
||
|
name: "{{ item.name }}"
|
||
|
password: "{{ pterodactyl_mysql_user_pwd }}"
|
||
|
priv: "{{ item.priv }}"
|
||
|
state: present
|
||
|
login_password: "{{ mysql_root_pwd }}"
|
||
|
login_unix_socket: /var/run/mysqld/mysqld.sock
|
||
|
loop: "{{ mysql_users }}"
|
||
|
no_log: "{{ enable_no_log | default('true') }}"
|