From 75cf220549b38cc59fe25f268a4e06e712cfbe22 Mon Sep 17 00:00:00 2001 From: Solomon Gifford Date: Fri, 10 Apr 2015 09:29:52 -0400 Subject: [PATCH] Fixes #26 to remove all anonymous users, particularly the one with the host as the hostname --- tasks/secure-installation.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tasks/secure-installation.yml b/tasks/secure-installation.yml index a3a4f90..0e4d368 100644 --- a/tasks/secure-installation.yml +++ b/tasks/secure-installation.yml @@ -20,8 +20,17 @@ group: root 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. - mysql_user: "name='' state=absent" + mysql_user: + name: "" + host: "{{ item }}" + state: absent + with_items: mysql_anonymous_hosts.stdout_lines - name: Remove MySQL test database. mysql_db: "name='test' state=absent" \ No newline at end of file