lowlydba.sqlserver.database module – Creates and configures a database
Note
This module is part of the lowlydba.sqlserver collection (version 2.3.4).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install lowlydba.sqlserver
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: lowlydba.sqlserver.database
.
New in lowlydba.sqlserver 0.1.0
Synopsis
Adds a new database to an existing SQL Server instance.
Requirements
The below requirements are needed on the host that executes this module.
dbatools PowerShell module
Parameters
Parameter |
Comments |
---|---|
Compatibility mode for the database. Follows the format of String is validated by |
|
Directory where the data files should be placed. Uses SQL Server’s default if not supplied. Only used if database is being created. |
|
Name of the target database. |
|
Directory where the log files should be placed. Uses SQL Server’s default if not supplied. Only used if database is being created. |
|
MAXDOP value for the database. |
|
Whether or not to enable Read Committed Snapshot Isolation. Choices:
|
|
Database owner login. |
|
Whether or not to enable Read Committed Snapshot Isolation. Choices:
|
|
Choose the recovery model for the database. Choices:
|
|
MAXDOP value for the database when it is a non-primary replica in an availability group. |
|
The SQL Server instance to modify. |
|
Password for SQL Authentication. |
|
Username for SQL Authentication. |
|
Whether or not the object should be Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in check_mode and return changed status prediction without modifying target. |
|
Platforms: all |
Target OS/families that can be operated against. |
Examples
- name: Create database
lowlydba.sqlserver.database:
sql_instance: sql-01.myco.io
database: LowlyDB
- name: Create database with customizations
lowlydba.sqlserver.database:
sql_instance: sql-01.myco.io
database: LowlyDB
owner: sa
maxdop: 2
recovery_model: Simple
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Modified output from the Returned: success, but not in check_mode. |