lowlydba.sqlserver.ag_replica module – Configures an availability group replica
Note
This module is part of the lowlydba.sqlserver collection (version 2.7.0).
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.ag_replica.
New in lowlydba.sqlserver 0.5.0
Synopsis
- Configures an availability group replica. 
Requirements
The below requirements are needed on the host that executes this module.
- dbatools PowerShell module 
Parameters
| Parameter | Comments | 
|---|---|
| Name of the Availability Group that will have the new replica joined to it. | |
| Whether the replica should be Asynchronous or Synchronous. Choices: 
 | |
| Sets the backup priority availability group replica. Default:  | |
| Cluster type of the Availability Group. Only supported in SQL Server 2017 and above. Choices: 
 | |
| Configure the AlwaysOn_health extended events session to start automatically as the SSMS wizard would do. Choices: 
 | |
| Which connections can be made to the database when it is in the primary role. Choices: 
 | |
| Which connections can be made to the database when it is in the secondary role. Choices: 
 | |
| By default, this command will attempt to find a DatabaseMirror endpoint. If one does not exist, it will create it. Default:  | |
| By default, the property  | |
| Whether the replica have Automatic or Manual failover. Choices: 
 | |
| Sets the read only routing connection url for the availability replica. | |
| Sets the read only routing ordered list of replica server names to use when redirecting read-only connections through this availability replica. | |
| Default seeding mode for the replica. Should remain as the default otherwise manual setup may be required. Choices: 
 | |
| How many seconds an availability replica waits for a ping response from a connected replica before considering the connection to have failed. | |
| The SQL Server instance to modify. | |
| The SQL Server instance where of the replica to be configured. | |
| Password for SQL Authentication. | |
| Password for SQL Authentication for the secondary replica. | |
| Username for SQL Authentication. | |
| Username for SQL Authentication for the secondary replica. | |
| 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 Availability Group
  lowlydba.sqlserver.availability_group:
    sql_instance: sql-01.myco.io
    ag_name: AG_MyDatabase
- name: Add a DR replica
  lowlydba.sqlserver.ag_replica:
    ag_name: 'AG_MyDatabase'
    sql_instance_primary: sql-01.myco.io
    sql_instance_replica: sql-02.myco.io
    failover_mode: 'Manual'
    availability_mode: 'Asynchronous'
    seeding_mode: 'Automatic'
    connection_mode_in_primary_role: 'AllowAllConnections'
    connection_mode_in_secondary_role: 'AllowNoConnections'
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| Output from the  Returned: success, but not in check_mode. | 
