Module to provide MS SQL Server compatibility to salt.
FreeTDS
pymssql Python module
In order to connect to MS SQL Server, certain configuration is required in minion configs/pillars on the relevant minions. Some sample pillars might look like:
mssql.server: 'localhost'
mssql.port: 1433
mssql.user: 'sysdba'
mssql.password: 'Some preferable complex password'
mssql.database: ''
The default for the port is '1433' and for the database is '' (empty string); in most cases they can be left at the default setting. Options that are directly passed into functions will overwrite options from configs or pillars.
Creates a new database. Does not update options of existing databases. new_database_options can only be a list of strings
CLI Example:
salt minion mssql.db_create DB_NAME
Find if a specific database exists on the MS SQL server.
CLI Example:
salt minion mssql.db_exists database_name='DBNAME'
Return the database list created on a MS SQL server.
CLI Example:
salt minion mssql.db_list
Drops a specific database from the MS SQL server. It will not drop any of 'master', 'model', 'msdb' or 'tempdb'.
CLI Example:
salt minion mssql.db_remove database_name='DBNAME'
Creates a new login. Does not update password of existing logins. For
Windows authentication, provide new_login_domain
. For SQL Server
authentication, prvide new_login_password
. Since hashed passwords are
varbinary values, if the new_login_password
is 'int / long', it will
be considered to be HASHED.
a list of SERVER roles
a list of strings
CLI Example:
salt minion mssql.login_create LOGIN_NAME database=DBNAME [new_login_password=PASSWORD]
Find if a login exists in the MS SQL server. domain, if provided, will be prepended to login
CLI Example:
salt minion mssql.login_exists 'LOGIN'
Removes an login.
CLI Example:
salt minion mssql.login_remove LOGINNAME
Creates a new database role. If no owner is specified, the role will be owned by the user that executes CREATE ROLE, which is the user argument or mssql.user option. grants is list of strings.
CLI Example:
salt minion mssql.role_create role=product01 owner=sysdba grants='["SELECT", "INSERT", "UPDATE", "DELETE", "EXECUTE"]'
Checks if a role exists.
CLI Example:
salt minion mssql.role_exists db_owner
Lists database roles.
CLI Example:
salt minion mssql.role_list
Remove a database role.
CLI Example:
salt minion mssql.role_create role=test_role01
Run a SQL query and return query result as list of tuples, or a list of dictionaries if as_dict was passed, or an empty list if no data is available.
CLI Example:
salt minion mssql.tsql_query 'SELECT @@version as version' as_dict=True
Creates a new user. If login is not specified, the user will be created without a login. domain, if provided, will be prepended to username. options can only be a list of strings
CLI Example:
salt minion mssql.user_create USERNAME database=DBNAME
Find if an user exists in a specific database on the MS SQL server. domain, if provided, will be prepended to username
CLI Example:
salt minion mssql.user_exists 'USERNAME' [database='DBNAME']
Get the user list for a specific database on the MS SQL server.
CLI Example:
salt minion mssql.user_list [database='DBNAME']
Removes an user.
CLI Example:
salt minion mssql.user_remove USERNAME database=DBNAME
Return the version of a MS SQL server.
CLI Example:
salt minion mssql.version