Debian Codegraph @

ansible_collections/lowlydba/sqlserver/plugins/modules/database.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # (c) 2022, John McCall (@lowlydba)
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = r'''
8 ---
9 module: database
10 short_description: Creates and configures a database
11 description:
12 - Adds a new database to an existing SQL Server instance.
13 version_added: 0.1.0
14 options:
15 database:
16 description:
17 - Name of the target database.
18 type: str
19 required: true
20 recovery_model:
21 description:
22 - Choose the recovery model for the database.
23 type: str
24 required: false
25 choices: ['Full', 'Simple', 'BulkLogged']
26 data_file_path:
27 description:
28 - Directory where the data files should be placed. Uses SQL Server's default if not supplied.
29 - Only used if database is being created.
30 type: str
31 required: false
32 log_file_path:
33 description:
34 - Directory where the log files should be placed. Uses SQL Server's default if not supplied.
35 - Only used if database is being created.
36 type: str
37 required: false
38 owner:
39 description:
40 - Database owner login.
41 type: str
42 required: false
43 maxdop:
44 description:
45 - MAXDOP value for the database.
46 required: false
47 type: int
48 secondary_maxdop:
49 description:
50 - MAXDOP value for the database when it is a non-primary replica in an availability group.
51 required: false
52 type: int
53 compatibility:
54 description:
55 - Compatibility mode for the database. Follows the format of C(Version90), C(Version100), and so on.
56 - String is validated by C(Set-DbaDbCompatibility).
57 required: false
58 type: str
59 rcsi:
60 description:
61 - Whether or not to enable Read Committed Snapshot Isolation.
62 required: false
63 type: bool
64 only_accessible:
65 description:
66 - Whether or not to enable Read Committed Snapshot Isolation.
67 default: true
68 required: false
69 type: bool
70 version_added: '2.2.0'
71 author: "John McCall (@lowlydba)"
72 requirements:
73 - L(dbatools,https://www.powershellgallery.com/packages/dbatools/) PowerShell module
74 extends_documentation_fragment:
75 - lowlydba.sqlserver.sql_credentials
76 - lowlydba.sqlserver.attributes.check_mode
77 - lowlydba.sqlserver.attributes.platform_all
78 - lowlydba.sqlserver.state
79 '''
80
81 EXAMPLES = r'''
82 - name: Create database
83 lowlydba.sqlserver.database:
84 sql_instance: sql-01.myco.io
85 database: LowlyDB
86
87 - name: Create database with customizations
88 lowlydba.sqlserver.database:
89 sql_instance: sql-01.myco.io
90 database: LowlyDB
91 owner: sa
92 maxdop: 2
93 recovery_model: Simple
94 '''
95
96 RETURN = r'''
97 data:
98 description: Modified output from the C(New-DbaDatabase), C(Set-DbaDatabase), or C(Remove-DbaDatabase) function.
99 returned: success, but not in check_mode.
100 type: dict
101 '''