Hi folks. I am pretty new to Ansible though have been assigned a project to failover a Microsoft SQL database from a primary data center to a DR site. What I an uncertain of is how to structure that’s below in Ansible and execute the sql scripts remotely. Would anyone be able to help here? Would anyone have a module/modules to use to accomplish all of this?
//Stop application
-stop iis on servers a, b and c
-stop windows services on servers d, e, and f
-stop scheduled tasks on servers d, e, and f
//No pending transactions replicating
-execute a SQL script(to check if any replication is in flight) on DB server G
-if records in queue =0, continue. If query returns anything other than 0, wait 30 seconds and rerun the query. Needs to be 0 before continuing
//Stop log reader agent and drop publications and subscriptions
-execute SQL script on server G to stop log reader agent
-execute SQL script on server G to drop replication publications
-execute SQL script on server H to drop all replication subscriptions
-execute SQL script on server I to drop all replication subscriptions
-execute SQL script on server J to drop all replication subscriptions
//Failover Databases
-execute SQL script to failover databases from primary to dr
Configure replication
-execute SQL script on server G to create replication publications
-execute SQL script on server H to create all replication subscriptions
-execute SQL script on server I to create all replication subscriptions
-execute SQL script on server J to create all replication subscriptions
Thank you in advance.