問題描述
我使用以下 ansible 任務將所有權限授予所有數據庫.
I used following ansible task to GRANT ALL privilege to all databases.
- name: create new user {{ db_user }} with all privilege
mysql_user: name="{{ db_user }}"
password="{{ db_password }}"
append_privs=yes
priv=*.*:ALL,GRANT state=present
但是當我在 mysql(mariadb)
上運行 show grants for 'dbuser'@'XX.XX.XX.XX';
它顯示我跟隨.
but when I run show grants for 'dbuser'@'XX.XX.XX.XX';
on mysql(mariadb)
it shows me following.
GRANT USAGE ON *.* TO 'dbuser'@'XX.XX.XX.XX' IDENTIFIED BY PASSWORD '*A7AD1ECBCD787B8CABE6A58AEA652A8B3CF5035BA82'
如何使用 ansible 將此 USAGE 更改為 GRANT ALL?
How to change this USAGE to GRANT ALL using ansible?
推薦答案
默認情況下 mysql_user
使用 localhost
主機部分創建用戶.
因此,您的任務使用 GRANT ALL
創建了 dbuser@localhost
.
如果您需要其他主機,請為模塊設置 host=XX.XX.XX.XX
參數.
從 2.1 開始修改權限時也有 host_all=yes
可用.
By default mysql_user
creates users with localhost
host portion.
So your task created dbuser@localhost
with GRANT ALL
.
If you need another host, set host=XX.XX.XX.XX
parameter for the module.
Also there is host_all=yes
available since 2.1 when modifying permissions.
這篇關于Ansible 不會將權限從 USAGE 更改為 GRANT ALL的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!