Debian Codegraph @

ansible_collections/lowlydba/sqlserver/plugins/modules/login.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: login
10 short_description: Configures a login for the target SQL Server instance
11 description:
12 - Creates, modifies, or removes a Windows or SQL Authentication login on a SQL Server instance.
13 version_added: 0.1.0
14 options:
15 login:
16 description:
17 - Name of the login to configure.
18 type: str
19 required: true
20 password:
21 description:
22 - Password for the login, if SQL Authentication login.
23 type: str
24 required: false
25 enabled:
26 description:
27 - Whether the login is enabled or disabled.
28 type: bool
29 required: false
30 default: true
31 version_added: '0.4.0'
32 default_database:
33 description:
34 - Default database for the login.
35 type: str
36 required: false
37 language:
38 description:
39 - Default language for the login. Only used when creating a new login, not when modifying an existing one.
40 type: str
41 required: false
42 password_must_change:
43 description:
44 - Enforces user must change password at next login.
45 - When specified will enforce I(password_expiration_enabled) and I(password_policy_enforced) as they are required.
46 type: bool
47 required: false
48 password_policy_enforced:
49 description:
50 - Enforces password complexity policy.
51 type: bool
52 required: false
53 password_expiration_enabled:
54 description:
55 - Enforces password expiration policy. Requires I(password_policy_enforced=true).
56 type: bool
57 required: false
58 sid:
59 description:
60 - Provide an explicit Sid that should be used when creating the account.
61 type: str
62 required: false
63 version_added: '2.1.0'
64 skip_password_reset:
65 description:
66 - Skips the password reset if the login exists and I(password) is set.
67 type: bool
68 required: false
69 default: false
70 version_added: '2.3.0'
71 author: "John McCall (@lowlydba)"
72 notes:
73 - Module will always return changed if a password is supplied.
74 requirements:
75 - L(dbatools,https://www.powershellgallery.com/packages/dbatools/) PowerShell module
76 extends_documentation_fragment:
77 - lowlydba.sqlserver.sql_credentials
78 - lowlydba.sqlserver.attributes.check_mode
79 - lowlydba.sqlserver.attributes.platform_all
80 - lowlydba.sqlserver.state
81 '''
82
83 EXAMPLES = r'''
84 - name: Create a login
85 lowlydba.sqlserver.login:
86 sql_instance: sql-01.myco.io
87 login: TheIntern
88 password: ReallyComplexStuff12345!
89
90 - name: Disable a login
91 lowlydba.sqlserver.login:
92 sql_instance: sql-01.myco.io
93 login: TheIntern
94 enabled: false
95 '''
96
97 RETURN = r'''
98 data:
99 description: Output from the C(New-DbaLogin), C(Set-DbaLogin), or C(Remove-DbaLogin) function.
100 returned: success, but not in check_mode.
101 type: dict
102 '''