lowlydba.sqlserver.availability_group module – Configures availability group(s)

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

New in lowlydba.sqlserver 0.4.0

Synopsis

  • Configures SQL Server Availability Group(s) with up to one replica.

Requirements

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

Parameters

Parameter

Comments

ag_name

string / required

Name of the Availability Group.

all_ags

boolean

Apply changes to all availability groups on the instance. Only used for configuring existing availability groups.

Choices:

  • false

  • true

allow_null_backup

boolean

Allow taking a full backup to NULL if one does not exist and seeding_mode=Automatic.

Choices:

  • false

  • true

automated_backup_preference

string

How to handle backup requests by default.

Choices:

  • "None"

  • "Primary"

  • "Secondary" ← (default)

  • "SecondaryOnly"

availability_mode

string

Whether the replica should be Asynchronous or Synchronous.

Only used in creating a new availability group.

Choices:

  • "AsynchronousCommit"

  • "SynchronousCommit" ← (default)

basic_availability_group

boolean

Indicates whether the availability group is Basic Availability Group.

Choices:

  • false

  • true

cluster_type

string

Cluster type of the Availability Group. Only supported in SQL Server 2017 and above.

Choices:

  • "Wsfc" ← (default)

  • "External"

  • "None"

contained_availability_group

boolean

Indicates whether the availability group is Contained. Requires DBATools >= 2.1.15

Choices:

  • false

  • true

database

aliases: database_name

string

Name of the database to create the Availability Group for.

database_health_trigger

boolean

Indicates whether the availability group triggers the database health.

Choices:

  • false

  • true

dtc_support_enabled

boolean

Enables Dtc support.

Choices:

  • false

  • true

failover_mode

string

Whether the replica have Automatic or Manual failover.

Choices:

  • "Automatic" ← (default)

  • "Manual"

failure_condition_level

string

Specifies the different conditions that can trigger an automatic failover in Availability Group.

Choices:

  • "OnAnyQualifiedFailureCondition"

  • "OnCriticalServerErrors"

  • "OnModerateServerErrors"

  • "OnServerDown"

  • "OnServerUnresponsive"

force

boolean

Drop and recreate the database on remote servers using fresh backup.

Choices:

  • false

  • true

healthcheck_timeout

integer

This setting used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait for information returned by the sp_server_diagnostics stored procedure before reporting the Always On Failover Cluster Instance (FCI) as unresponsive.

Changes that are made to the timeout settings are effective immediately and do not require a restart of the SQL Server resource.

is_distributed_ag

boolean

Indicates whether the availability group is distributed.

Choices:

  • false

  • true

seeding_mode

string

Default seeding mode for the replica. Should remain as the default otherwise manual setup may be required.

Choices:

  • "Automatic"

  • "Manual" ← (default)

shared_path

string

The network share where the backups will be backed up and restored from.

sql_instance

string / required

The SQL Server instance to modify.

sql_instance_secondary

string

The secondary SQL Server instance for the new Availability Group.

sql_password

string

Password for SQL Authentication.

sql_password_secondary

string

Password for SQL Authentication for the secondary replica.

sql_username

string

Username for SQL Authentication.

sql_username_secondary

string

Username for SQL Authentication for the secondary replica.

state

string

Whether or not the object should be present or absent.

Choices:

  • "present" ← (default)

  • "absent"

use_last_backup

boolean

Use the last full and log backup of database. A log backup must be the last backup.

Choices:

  • false

  • true

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.

Examples

- name: Create Availability Group
  lowlydba.sqlserver.availability_group:
    sql_instance: sql-01.myco.io
    ag_name: AG_MyDatabase

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-DbaAvailabilityGroup or Set-DbaAvailabilityGroup function.

Returned: success, but not in check_mode.

Authors

  • John McCall (@lowlydba)