Automatic mysql_secure_installation

This commit is contained in:
LinuxSquare 2024-12-01 17:18:25 +01:00
parent f9232d32b2
commit b291330bc9

View file

@ -7,3 +7,22 @@
- mariadb
- mariadb-client
- mariadb-openrc
- name: Update MariaDB root password
mysql_user: name=root host={{item}} password={{mysql_root_password}}
with_items:
- 127.0.0.1
- ::1
- localhost
- name: Delete anonymous MySQL user
mysql_user: name="" host={{item}} state=absent
with_items:
- localhost
- "{{ansible_nodename}}"
- name: Delete Hostname based MySQL user
mysql_user: name=root host="{{ansible_nodename}}" state=absent
- name: Remove MySQL test database
mysql_db:
name: test
state: absent