lowlydba.sqlserver.login module – Configures a login for the target SQL Server instance

Note

This module is part of the lowlydba.sqlserver collection (version 2.3.3).

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.login.

New in lowlydba.sqlserver 0.1.0

Synopsis

  • Creates, modifies, or removes a Windows or SQL Authentication login on a SQL Server instance.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter

Comments

default_database

string

Default database for the login.

enabled

boolean

added in lowlydba.sqlserver 0.4.0

Whether the login is enabled or disabled.

Choices:

  • false

  • true ← (default)

language

string

Default language for the login. Only used when creating a new login, not when modifying an existing one.

login

string / required

Name of the login to configure.

password

string

Password for the login, if SQL Authentication login.

password_expiration_enabled

boolean

Enforces password expiration policy. Requires password_policy_enforced=true.

Choices:

  • false

  • true

password_must_change

boolean

Enforces user must change password at next login.

When specified will enforce password_expiration_enabled and password_policy_enforced as they are required.

Choices:

  • false

  • true

password_policy_enforced

boolean

Enforces password complexity policy.

Choices:

  • false

  • true

sid

string

added in lowlydba.sqlserver 2.1.0

Provide an explicit Sid that should be used when creating the account.

skip_password_reset

boolean

added in lowlydba.sqlserver 2.3.0

Skips the password reset if the login exists and password is set.

Choices:

  • false ← (default)

  • true

sql_instance

string / required

The SQL Server instance to modify.

sql_password

string

Password for SQL Authentication.

sql_username

string

Username for SQL Authentication.

state

string

Whether or not the object should be present or absent.

Choices:

  • "present" ← (default)

  • "absent"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

platform

Platforms: all

Target OS/families that can be operated against.

Notes

Note

  • Module will always return changed if a password is supplied.

Examples

- name: Create a login
  lowlydba.sqlserver.login:
    sql_instance: sql-01.myco.io
    login: TheIntern
    password: ReallyComplexStuff12345!

- name: Disable a login
  lowlydba.sqlserver.login:
    sql_instance: sql-01.myco.io
    login: TheIntern
    enabled: false

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

data

dictionary

Output from the New-DbaLogin, Set-DbaLogin, or Remove-DbaLogin function.

Returned: success, but not in check_mode.

Authors

  • John McCall (@lowlydba)