Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing ip_address param to expect list #246

Merged
merged 9 commits into from
Jun 6, 2024
2 changes: 2 additions & 0 deletions changelogs/fragments/245-ag_listener-ip_address-fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- fixed the expected type of the ip_address, subnet_ip, and subnet_mask parameters to be lists instead of strings (lowlydba.sqlserver.ag_listener)
6 changes: 3 additions & 3 deletions plugins/modules/ag_listener.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ $spec = @{
options = @{
ag_name = @{type = 'str'; required = $true }
listener_name = @{type = 'str'; required = $true }
ip_address = @{type = 'str'; required = $false }
subnet_ip = @{type = 'str'; required = $false }
subnet_mask = @{type = 'str'; required = $false; default = '255.255.255.0' }
ip_address = @{type = 'list'; elements = 'str'; required = $false }
subnet_ip = @{type = 'list'; elements = 'str'; required = $false }
subnet_mask = @{type = 'list'; elements = 'str'; required = $false; default = '255.255.255.0' }
port = @{type = 'int'; required = $false; default = 1433 }
dhcp = @{type = 'bool'; required = $false; default = $false }
state = @{type = "str"; required = $false; default = "present"; choices = @("present", "absent") }
Expand Down
19 changes: 13 additions & 6 deletions plugins/modules/ag_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
ip_address:
description:
- IP address(es) of the listener. Comma separated if multiple.
type: str
type: list
elements: str
required: false
subnet_ip:
description:
- Subnet IP address(es) of the listener. Comma separated if multiple.
type: str
type: list
elements: str
required: false
subnet_mask:
description:
- Sets the subnet IP mask(s) of the availability group listener. Comma separated if multiple.
type: str
type: list
elements: str
required: false
default: 255.255.255.0
port:
Expand Down Expand Up @@ -71,9 +74,13 @@
sql_instance_primary: sql-01.myco.io
ag_name: AG_MyDatabase
listener_name: aglMyDatabase
ip_address: 10.0.20.20,10.1.77.77
subnet_ip: 255.255.252.0
subnet_mask: 255.255.255.0
ip_address:
- 10.0.20.20
- 10.1.77.77
subnet_ip:
- 255.255.252.0
subnet_mask:
- 255.255.255.0
'''

RETURN = r'''
Expand Down
10 changes: 7 additions & 3 deletions plugins/modules/spn.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@
sql_instance_primary: sql-01.myco.io
ag_name: AG_MyDatabase
listener_name: aglMyDatabase
ip_address: 10.0.20.20,10.1.77.77
subnet_ip: 255.255.252.0
subnet_mask: 255.255.255.0
ip_address:
- 10.0.20.20
- 10.1.77.77
subnet_ip:
- 255.255.252.0
subnet_mask:
- 255.255.255.0

- name: Add SPN for new AG listener on port 1433
lowlydba.sqlserver.spn:
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/targets/win_ag_listener/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
ag_name: "{{ ag_name }}"
listener_name: "{{ listener_name }}"
port: "{{ port }}"
ip_address: "192.168.6.9"
subnet_mask: "255.255.255.0"
ip_address:
- "192.168.6.9"
subnet_mask:
- "255.255.255.0"
tags: ["ag_listener"]
block:
- name: Enable hadr
Expand Down
Loading