fix syntax of mysql queries
Signed-off-by: Sebastian Gumprich <[email protected]>
This commit is contained in:
1 parent
e1f0efb220
commit
d4a4faa16d
1 file changed
+22
-3
@@ -37,14 +37,25 @@
|
||||
- name: ensure that root can only login from localhost
|
||||
community.mysql.mysql_query:
|
||||
query:
|
||||
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
|
||||
- DELETE
|
||||
FROM mysql.user
|
||||
WHERE USER='root'
|
||||
AND HOST NOT IN ('localhost',
|
||||
'127.0.0.1',
|
||||
'::1')
|
||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||
when: mysql_remove_remote_root
|
||||
|
||||
- name: get all users that have no password or authentication_string on MySQL version >= 5.7.6
|
||||
community.mysql.mysql_query:
|
||||
query:
|
||||
- select GROUP_CONCAT(user,'@',host SEPARATOR ', ') as users from mysql.user where (length(password)=0 or password="") and (length(authentication_string)=0 or authentication_string="") and user NOT IN ('mysql.sys', 'mysqlxsys', 'mariadb.sys');
|
||||
- SELECT GROUP_CONCAT(USER, '@', HOST SEPARATOR ', ') AS users
|
||||
FROM mysql.user
|
||||
WHERE (length(authentication_string)=0
|
||||
OR authentication_string="")
|
||||
AND USER NOT IN ('mysql.sys',
|
||||
'mysqlxsys',
|
||||
'mariadb.sys');
|
||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||
register: mysql_users_wo_passwords_or_auth_string
|
||||
when:
|
||||
@@ -53,7 +64,15 @@
|
||||
- name: get all users that have no password on MySQL version < 5.7.6
|
||||
community.mysql.mysql_query:
|
||||
query:
|
||||
- select GROUP_CONCAT(user,'@',host SEPARATOR ', ') as users from mysql.user where (length(password)=0 or password="") and user NOT IN ('mysql.sys', 'mysqlxsys', 'mariadb.sys');
|
||||
- SELECT GROUP_CONCAT(USER, '@', HOST SEPARATOR ', ') AS users
|
||||
FROM mysql.user
|
||||
WHERE (length(password)=0
|
||||
OR password="")
|
||||
AND (length(authentication_string)=0
|
||||
OR authentication_string="")
|
||||
AND USER NOT IN ('mysql.sys',
|
||||
'mysqlxsys',
|
||||
'mariadb.sys');
|
||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||
register: mysql_users_wo_passwords
|
||||
when:
|
||||
|
||||
Reference in new issue
Block a user