lowlydba.sqlserver.ag_listener module – Configures an availability group listener

Note

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

You might already have this collection installed if you are using the ansible package. 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_listener.

New in lowlydba.sqlserver 0.5.0

Synopsis

  • Creates an Availability Group Listener for an existing availability group.

Requirements

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

Parameters

Parameter

Comments

ag_name

string / required

Name of the target availability group.

dhcp

boolean

Indicates whether the listener uses DHCP.

If this differs from the listener’s current configuration, the listener is dropped and re-created since this cannot be altered in place.

Choices:

  • false ← (default)

  • true

ip_address

list / elements=string

IP address(es) of the listener. Comma separated if multiple.

If this differs from the listener’s current IP address(es), the listener is dropped and re-created since IP addresses cannot be altered in place.

listener_name

string / required

Name of the Listener to be configured.

port

integer

Sets the port number used to communicate with the availability group.

Default: 1433

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"

subnet_ip

list / elements=string

Subnet IP address(es) of the listener. Comma separated if multiple.

Only reconciled against an existing listener when ip_address is also supplied. Has no effect and is not reconciled when dhcp=true.

subnet_mask

list / elements=string

Sets the subnet IP mask(s) of the availability group listener. Comma separated if multiple.

Only reconciled against an existing listener when ip_address is also supplied. Has no effect and is not reconciled when dhcp=true.

Default: ["255.255.255.0"]

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 an availability group
  lowlydba.sqlserver.availability_group:
    sql_instance: sql01.example.com
    ag_name: AG_App

- name: Create an availability group listener
  lowlydba.sqlserver.ag_listener:
    sql_instance: sql01.example.com
    ag_name: AG_App
    listener_name: AG-App
    ip_address:
      - 10.0.20.20
    subnet_ip:
      - 10.0.20.0
    subnet_mask:
      - 255.255.255.0

Return Values

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

Key

Description

data

dictionary

Output from the Add-DbaAgListener or Set-DbaAgListener function. When an existing listener’s IP/DHCP configuration is reconciled, this is the output of the Add-DbaAgListener call used to re-create it.

Returned: success, but not in check_mode.

Authors

  • John McCall (@lowlydba)