mirror of
https://github.com/aljazceru/ansible-role-mysql.git
synced 2025-12-19 16:04:37 +01:00
Merge pull request #29 from BlackMesh/remove-anonymous-users
Fixes #26: Remove all anonymous users (not just the 'localhost' anonymous user).
This commit is contained in:
@@ -21,8 +21,17 @@
|
|||||||
group: root
|
group: root
|
||||||
mode: 0600
|
mode: 0600
|
||||||
|
|
||||||
|
- name: Get list of hosts for anonymous user
|
||||||
|
command: mysql -NBe 'SELECT Host from mysql.user WHERE User = ""'
|
||||||
|
register: mysql_anonymous_hosts
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: Remove anonymous MySQL user.
|
- name: Remove anonymous MySQL user.
|
||||||
mysql_user: "name='' state=absent"
|
mysql_user:
|
||||||
|
name: ""
|
||||||
|
host: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
with_items: mysql_anonymous_hosts.stdout_lines
|
||||||
|
|
||||||
- name: Remove MySQL test database.
|
- name: Remove MySQL test database.
|
||||||
mysql_db: "name='test' state=absent"
|
mysql_db: "name='test' state=absent"
|
||||||
Reference in New Issue
Block a user