add gaming mysql configs & user
This commit is contained in:
parent
54de7c011b
commit
8d5dcef849
5 changed files with 43 additions and 4 deletions
7
mysql/files/my.cnf.j2
Normal file
7
mysql/files/my.cnf.j2
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[client]
|
||||||
|
user=root
|
||||||
|
password={{MYSQL_ROOT_PASSWORD}}
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
user=root
|
||||||
|
password={{MYSQL_ROOT_PASSWORD}}
|
|
@ -2,3 +2,5 @@
|
||||||
- import_playbook: directory.ansible.yml
|
- import_playbook: directory.ansible.yml
|
||||||
- import_playbook: service.ansible.yml
|
- import_playbook: service.ansible.yml
|
||||||
- import_playbook: secure.ansible.yml
|
- import_playbook: secure.ansible.yml
|
||||||
|
- import_playbook: modes/gaming.ansible.yml
|
||||||
|
when: installation_type == 'gaming'
|
||||||
|
|
2
mysql/modes/files/pterodactyl-mariadb-server.cnf.j2
Normal file
2
mysql/modes/files/pterodactyl-mariadb-server.cnf.j2
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[mysqld]
|
||||||
|
bind-address={{IPv4}}
|
18
mysql/modes/gaming.ansible.yml
Normal file
18
mysql/modes/gaming.ansible.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
- hosts: localhost
|
||||||
|
tasks:
|
||||||
|
- name: Set bind-address
|
||||||
|
template:
|
||||||
|
src: files/pterodactyl-mariadb-server.cnf.j2
|
||||||
|
dest: /etc/my.cnf.d/pterodactyl-mariadb-server.cnf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
vars:
|
||||||
|
IPv4: "{{ansible_default_ipv4.address}}"
|
||||||
|
- name: Create pterodactyl user
|
||||||
|
mysql_user:
|
||||||
|
name: pterodactyl
|
||||||
|
password: "{{mysql_root_password}}"
|
||||||
|
host: "{{ansible_default_ipv4.address}}"
|
||||||
|
priv: '*.*:ALL,GRANT'
|
||||||
|
state: present
|
|
@ -5,26 +5,36 @@
|
||||||
path: /var/lib/mysql/.secured
|
path: /var/lib/mysql/.secured
|
||||||
register: MYSQL_SECURED_RESULT
|
register: MYSQL_SECURED_RESULT
|
||||||
- name: Set the root password
|
- name: Set the root password
|
||||||
mysql_user: login_user=root login_password="" user=root password="{{mysql_root_password}}" host="{{item}}"
|
mysql_user: user=root password="{{mysql_root_password}}" host="{{item}}"
|
||||||
with_items:
|
with_items:
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
- ::1
|
- ::1
|
||||||
- localhost
|
- localhost
|
||||||
no_log: true
|
no_log: true
|
||||||
when: not MYSQL_SECURED_RESULT.stat.exists
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
|
- name: Set root my.cnf
|
||||||
|
template:
|
||||||
|
src: files/my.cnf.j2
|
||||||
|
dest: /root/.my.cnf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
vars:
|
||||||
|
MYSQL_ROOT_PASSWORD: "{{mysql_root_password}}"
|
||||||
|
no_log: true
|
||||||
- name: Delete anonymous MySQL user
|
- name: Delete anonymous MySQL user
|
||||||
mysql_user: login_user=root login_password="{{mysql_root_password}}" name="" host="{{item}}" state=absent
|
mysql_user: name="" host="{{item}}" state=absent
|
||||||
with_items:
|
with_items:
|
||||||
- localhost
|
- localhost
|
||||||
- "{{ansible_nodename}}"
|
- "{{ansible_nodename}}"
|
||||||
no_log: true
|
no_log: true
|
||||||
when: not MYSQL_SECURED_RESULT.stat.exists
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
- name: Delete Hostname based MySQL user
|
- name: Delete Hostname based MySQL user
|
||||||
mysql_user: login_user=root login_password="{{mysql_root_password}}" user=root host="{{ansible_nodename}}" state=absent
|
mysql_user: user=root host="{{ansible_nodename}}" state=absent
|
||||||
no_log: true
|
no_log: true
|
||||||
when: not MYSQL_SECURED_RESULT.stat.exists
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
- name: Remove MySQL test database
|
- name: Remove MySQL test database
|
||||||
mysql_db: login_user=root login_password="{{mysql_root_password}}" name=test state=absent
|
mysql_db: name=test state=absent
|
||||||
no_log: true
|
no_log: true
|
||||||
when: not MYSQL_SECURED_RESULT.stat.exists
|
when: not MYSQL_SECURED_RESULT.stat.exists
|
||||||
- name: Create .secured lock file
|
- name: Create .secured lock file
|
||||||
|
|
Loading…
Reference in a new issue