This install will add High Availability components to a Linux install of SQL Server. The port tcp/5022 will be opened if SQL Server is running on CentOS. This install will also install SQL Server if that hasn't already been done by its dependencies.
mkdir ~/cnstechnicalgroup_install
cd ~/cnstechnicalgroup_install
vi ansible.cfg
and paste this information
[defaults]
roles_path = ~/cnstechnicalgroup
---
- src: cnstechnicalgroup.sqlserver-ha-config
name: cnstechnicalgroup.sqlserver-ha-config
ansible-galaxy install -r requirements.yml
cd ~/cnstechnicalgroup/sqlserver-ha-config
vi inventory
db1 ansible_ssh_host=some_ip_address ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.ssh/id_rsa
db2 ansible_ssh_host=some_ip_address ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.ssh/id_rsa
[replicas]
db1
db2
vi ansible.cfg
[defaults]
roles_path = ~/cnstechnicalgroup
hostfile = inventory
## 8. Create the playbook
```bash
vi dbserver_ha.yml
---
- hosts: replicas
sudo: yes
roles:
- cnstechnicalgroup.sqlserver-ha-config
gather_facts: yes
The primary_host name and ip represent the primary instance in the Always-On Group. The secondary_host name and ip represent the secondary instance in the Always-On Group that will server as the first read-only replica
mkdir vars
cd vars
vi main.yml
---
use_hosts_file: yes
primary_host_ip: primary_ip_address
secondary_host_ip: secondary_ip_address
primary_host_name: db1
secondary_host_name: db2
ansible-playbook dbserver_ha.yml