lowlydba / lowlydba.sqlserver

:spoon: A cross-platform Ansible collection using PowerShell to configure and maintain SQL Server.
https://galaxy.ansible.com/ui/repo/published/lowlydba/sqlserver
GNU General Public License v3.0
19 stars 12 forks source link

[Bug] lowlydba.sqlserver.database drop database in availability group does not work #200

Closed git-cgallagher closed 1 year ago

git-cgallagher commented 1 year ago

Describe the bug When attempting to set the state to absent for an availability database, it will register a change but doesn't actually drop the database. Non-readable secondary registers no change, but this is expected because OnlyAccessible is hardcoded to $true right now.

To Reproduce Create DB Add to AG Drop DB

Expected behavior Expected database to be dropped or failure because of AG dependency.

Versions(please complete the following information):

Additional context I believe we need a try/catch here. https://github.com/lowlydba/lowlydba.sqlserver/blob/main/plugins/modules/database.ps1#L66