feat: remove unused users in init
This commit is contained in:
parent
9e65c1b8fb
commit
40b6ef02b8
4 changed files with 33 additions and 13 deletions
tasks
|
@ -35,3 +35,29 @@
|
|||
command: 'mysqladmin -u root password {{ mariadb_password }}'
|
||||
when: True
|
||||
tags: mariadb
|
||||
|
||||
- name: remove anonymous users
|
||||
mysql_user:
|
||||
name: ''
|
||||
host_all: yes
|
||||
state: absent
|
||||
login_user: '{{ mariadb_user }}'
|
||||
login_password: '{{ mariadb_password }}'
|
||||
no_log: true
|
||||
tags: mariadb
|
||||
|
||||
- name: remove root user without password
|
||||
mysql_user:
|
||||
name: root
|
||||
host: '{{ item }}'
|
||||
state: absent
|
||||
login_user: '{{ mariadb_user }}'
|
||||
login_password: '{{ mariadb_password }}'
|
||||
loop:
|
||||
- 127.0.0.1
|
||||
- '::1'
|
||||
- '{{ ansible_nodename }}'
|
||||
no_log: true
|
||||
tags: mariadb
|
||||
|
||||
|
||||
|
|
|
@ -37,18 +37,6 @@
|
|||
enabled: yes
|
||||
tags: mariadb
|
||||
|
||||
- name: remove anonymous users
|
||||
mysql_user:
|
||||
name: ''
|
||||
host_all: yes
|
||||
state: absent
|
||||
login_user: '{{ mariadb_user }}'
|
||||
login_password: '{{ mariadb_password }}'
|
||||
run_once: true
|
||||
no_log: true
|
||||
when: mariadb_master
|
||||
tags: mariadb
|
||||
|
||||
- name: manage users
|
||||
mysql_user:
|
||||
name: '{{ item.name }}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue