View on GitHub

SQL Server Always On Puppet module

Puppet module installing a fully working SQL Server Always On cluster using Powershell DSC resources. Configuration includes SPN creation, SQL server installation and initial configuration, windows failover cluster and SQL Always On Availability Group creation.

Download this project as a .zip file Download this project as a tar.gz file

sqlserveralwayson

This modules installs a fully working Microsoft SQL Server AlwaysOn cluster. It has been designed to install both primary replica nodes with the following features :

Integration informations

The default MSSQLSERVER SQL Server instance is created during installation. This module does not provide the capability to create other SQL instances.

The database failover mecanism integrated in this module is SQL Server AlwaysOn.

The module can be installed on a Standard, Datacenter, Core version of Windows 2012R2 or Windows 2016.

BREAKING CHANGE : This module requires puppetlabs/dsc compiled with SQLServerDSC >= 10.0.0.0

Usage

Installing a Microsoft SQL Server AlwaysOn cluster

The following example creates a 2 nodes SQL Server Always On Availability group :

The replica node is installed with the same parameters and joined to the CLDB01 windows failover cluster and to the Avalability Group. Notice the role => ‘secondary’ which defines the role of the node.

Sample architecture :

Sample SQL Server Always On architecture

Sample Puppet code :

#Primary node
node 'SQL01' {
	class{'sqlserveralwayson':
	  setup_svc_username=>'DOMAIN-TEST\svc-puppet',
	  setup_svc_password=>'P@ssw0rd',
	  setupdir=>'\\fileserver.local\SQLServer2012.en',
	  sa_password=>'P@ssw0rd',
	  productkey => 'key-key-key',
	  sqlservicecredential_username => 'svc-sql-puppet',
	  sqlservicecredential_password=>'P@ssw0rd',
	  sqlagentservicecredential_username => 'svc-sql-puppet',
	  sqlagentservicecredential_password => 'P@ssw0rd',
	  sqladministratoraccounts => [ 'DOMAIN-TEST\svc-puppet', 'DOMAIN-TEST\Administrator' ],
	  clusterName => 'CLDB01',
	  clusterIP => '192.168.1.60',
	  fileShareWitness=> '\\192.168.1.10\quorum',
	  listenerIP => '192.168.1.61/255.255.255.0',
	  role => 'primary'
	}
}

#Replica node
node 'SQL02' {
	class{'sqlserveralwayson':
	  setup_svc_username=>'DOMAIN-TEST\svc-puppet',
	  setup_svc_password=>'P@ssw0rd',
	  setupdir=>'\\fileserver.local\SQLServer2012.en',
	  sa_password=>'P@ssw0rd',
	  productkey => 'key-key-key',
	  sqlservicecredential_username => 'svc-sql-puppet',
	  sqlservicecredential_password=>'P@ssw0rd',
	  sqlagentservicecredential_username => 'svc-sql-puppet',
	  sqlagentservicecredential_password => 'P@ssw0rd',
	  sqladministratoraccounts => [ 'DOMAIN-TEST\svc-puppet', 'DOMAIN-TEST\Administrator' ],
	  clusterName => 'CLDB01',
	  clusterIP => '192.168.1.60',
	  fileShareWitness=> '\\192.168.1.10\quorum',
	  listenerIP => '192.168.1.61/255.255.255.0',
	  role => 'secondary'
	}
}