問題描述
我使用以下 ansible 任務(wù)將所有權(quán)限授予所有數(shù)據(jù)庫.
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
但是當(dāng)我在 mysql(mariadb)
上運(yùn)行 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?
推薦答案
默認(rèn)情況下 mysql_user
使用 localhost
主機(jī)部分創(chuàng)建用戶.
因此,您的任務(wù)使用 GRANT ALL
創(chuàng)建了 dbuser@localhost
.
如果您需要其他主機(jī),請(qǐng)為模塊設(shè)置 host=XX.XX.XX.XX
參數(shù).
從 2.1 開始修改權(quán)限時(shí)也有 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.
這篇關(guān)于Ansible 不會(huì)將權(quán)限從 USAGE 更改為 GRANT ALL的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!