要为数据库创建授权,我使用以下salt模块
keystone_grants:
mysql_grants.present:
- database: keystone.*
- grant: ALL PRIVILEGES
- user: keystone
- host: localhost
但它创造了我这个
ID: Keystone_database
Function: mysql_grants.present
Result: True
Comment: Grant ALL PRIVILEGES on keystone.* to keystone@localhost has been added
Started: 19:42:18.428882
Duration: 4.089 ms
Changes:
即它为我创建了这个赠款
将keystone.*上的所有特权授予keystone@localhost
但我需要创建这个赠款
将keystone.*上的所有特权授予由“password”标识的“keystone”@“localhost”;
有人能建议我如何使用SaltStack添加带有密码的授权吗
此状态无法为来自指定主机的权限设置密码。有关进一步说明,请参阅salt.states.mysql_user。
这句话写在salt.modules.mysql_grants的文档中。它们从那里指向salt.states.mysql_user。可悲的是,这份文件并没有说明很多关于赠款的内容。
此状态无法授予用户权限。有关进一步的说明,请参见salt.states.mysql_grants。
也许两者都使用就足够了:
keystone_grants:
mysql_grants.present:
- host: localhost
- database: keystone.*
- grant: ALL PRIVILEGES
- user: keystone
- host: localhost
keystone:
mysql_user.present:
- host: localhost
- password: somesecret
另外,我推荐使用MySQL-Formula。