Management of MySQL grants (user permissions).
NOTE: This module requires the MySQLdb python module and the proper
settings in the minion config file.
See salt.modules.mysql for more information.
The mysql_grants module is used to grant and revoke MySQL permissions.
The name you pass in purely symbolic and does not have anything to do
with the grant itself.
The database parameter needs to specify a 'priv_level' in the same
specification as defined in the MySQL documentation:
- *
- *.*
- db_name.*
- db_name.tbl_name
- etc...
frank_exampledb:
mysql_grants.present:
- grant: select,insert,update
- database: exampledb.*
- user: frank
- host: localhost
frank_otherdb:
mysql_grants.present:
- grant: all privileges
- database: otherdb.*
- user: frank
restricted_singletable:
mysql_grants.present:
- grant: select
- database: somedb.sometable
- user: joe
-
salt.states.mysql_grants.absent(name, grant=None, database=None, user=None, host='localhost', grant_option=False, escape=True)
Ensure that the grant is absent
- name
- The name (key) of the grant to add
- grant
- The grant priv_type (i.e. select,insert,update OR all privileges)
- database
- The database priv_level (i.e. db.tbl OR db.*)
- user
- The user to apply the grant to
- host
- The network/host that the grant should apply to
-
salt.states.mysql_grants.present(name, grant=None, database=None, user=None, host='localhost', grant_option=False, escape=True)
Ensure that the grant is present with the specified properties
- name
- The name (key) of the grant to add
- grant
- The grant priv_type (i.e. select,insert,update OR all privileges)
- database
- The database priv_level (ie. db.tbl OR db.*)
- user
- The user to apply the grant to
- host
- The network/host that the grant should apply to
- grant_option
- Adds the WITH GRANT OPTION to the defined grant. default: False
- escape
- Defines if the database value gets escaped or not. default: True