-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from virtualdesktopdevops/dev
Release v2.0.0-PuppetForge
- Loading branch information
Showing
16 changed files
with
236 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pkg/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pkg/ | ||
tests/ | ||
assets/ | ||
_config.yml | ||
.fixtures.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog - sqlserveralwayson # | ||
|
||
## Version 2.0.0 | ||
- **BREAKING CHANGE** : Require puppetlabs/dsc compiled with SQLServerDSC >= 10.0.0.0 | ||
- **BREAKING CHANGE** : Changed $sqlservicecredential_username and $sqlagentservicecredential_username format. User accounts now required **WITHOUT** Netbios Domain Name prefix. | ||
- **BREAKING CHANGE** : Removed $domainName class parameter. Used facts instead. | ||
- **BREAKING CHANGE** : Removed $domainNetbiosName class parameter. Used custom fact instead. | ||
- Changed database availability mode to SynchronousCommit | ||
|
||
|
||
## Version 1.1.0 | ||
- Module compatible with xSQLServer <= 9.0.0.0 | ||
|
||
## Version 1.0.0 | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#https://puppet.com/blog/starting-out-writing-custom-facts-windows | ||
Facter.add('domainnetbiosname') do | ||
confine :osfamily => :windows | ||
setcode do | ||
begin | ||
require 'win32ole' | ||
dnsforestname = Facter.value(:domain) | ||
wmi = WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2") | ||
win32ntdomain = wmi.ExecQuery("SELECT * FROM Win32_NTDomain WHERE DnsForestName='#{dnsforestname}'").each.first | ||
win32ntdomain.DomainName | ||
rescue | ||
nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,91 @@ | ||
class sqlserveralwayson::alwaysonconfig inherits sqlserveralwayson { | ||
|
||
#Enable AlwaysOn on MSSQL service | ||
dsc_xsqlserveralwaysonservice{'EnableAlwaysOn': | ||
dsc_sqlalwaysonservice{'EnableAlwaysOn': | ||
dsc_ensure => 'Present', | ||
dsc_sqlserver => $hostname, | ||
dsc_sqlinstancename => 'MSSQLSERVER', | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_restarttimeout => 15, | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
}-> | ||
|
||
# Adding the required service account to allow the cluster to log into SQL | ||
dsc_xsqlserverlogin{'AddNTServiceClusSvc': | ||
dsc_sqlserverlogin{'AddNTServiceClusSvc': | ||
dsc_ensure => 'Present', | ||
dsc_name => 'NT SERVICE\ClusSvc', | ||
dsc_logintype => 'WindowsUser', | ||
dsc_sqlserver => $hostname, | ||
dsc_sqlinstancename => 'MSSQLSERVER', | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
}-> | ||
|
||
# Add the required permissions to the cluster service login | ||
dsc_xsqlserverpermission{'AddNTServiceClusSvcPermissions': | ||
dsc_sqlserverpermission{'AddNTServiceClusSvcPermissions': | ||
dsc_ensure => 'Present', | ||
dsc_nodename => $hostname, | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_principal => 'NT SERVICE\ClusSvc', | ||
dsc_permission => ['AlterAnyAvailabilityGroup', 'ViewServerState'], | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
}-> | ||
|
||
dsc_xsqlserverendpoint{'SQLServerEndpoint': | ||
dsc_sqlserverendpoint{'SQLServerEndpoint': | ||
dsc_endpointname => 'HADR', | ||
dsc_ensure => 'Present', | ||
dsc_port => '5022', | ||
dsc_sqlserver => $fqdn, | ||
dsc_sqlinstancename => 'MSSQLSERVER', | ||
dsc_servername => $fqdn, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
} | ||
dsc_xsqlserverendpointpermission{'SQLConfigureEndpointPermission': | ||
}-> | ||
|
||
dsc_sqlserverendpointpermission{'SQLConfigureEndpointPermission': | ||
dsc_ensure => 'Present', | ||
dsc_nodename => $hostname, | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_name => 'HADR', | ||
dsc_principal => $sqlservicecredential_username, | ||
dsc_principal => "${domainnetbiosname}\\$sqlservicecredential_username", | ||
dsc_permission => 'CONNECT', | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
} | ||
|
||
if ( $role == 'primary' ) { | ||
# Create the availability group on the instance tagged as the primary replica | ||
dsc_xsqlserveralwaysonavailabilitygroup{'CreateSQLAvailabilityGroup': | ||
dsc_sqlag{'CreateSQLAvailabilityGroup': | ||
dsc_ensure => 'Present', | ||
dsc_name => $clusterName, | ||
dsc_sqlserver => $hostname, | ||
dsc_sqlinstancename => 'MSSQLSERVER', | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_availabilitymode => 'SynchronousCommit', | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password}, | ||
require => [ Dsc_xsqlserveralwaysonservice['EnableAlwaysOn'] , Dsc_xsqlserverendpoint['SQLServerEndpoint'] ] | ||
require => [ Dsc_sqlalwaysonservice['EnableAlwaysOn'] , Dsc_sqlserverendpoint['SQLServerEndpoint'] ] | ||
} | ||
dsc_xsqlserveravailabilitygrouplistener{'AvailabilityGroupListener': | ||
|
||
dsc_sqlaglistener{'AvailabilityGroupListener': | ||
dsc_ensure => 'Present', | ||
dsc_nodename => $fqdn, | ||
dsc_servername => $fqdn, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_availabilitygroup => $clusterName, | ||
dsc_name => "${clusterName}LI", | ||
dsc_ipaddress => $listenerIP, | ||
dsc_port => 1433, | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password}, | ||
require => [ Dsc_xsqlserveralwaysonavailabilitygroup['CreateSQLAvailabilityGroup'] ] | ||
require => [ Dsc_sqlag['CreateSQLAvailabilityGroup'] ] | ||
} | ||
|
||
} | ||
else { | ||
dsc_xsqlserveralwaysonavailabilitygroupreplica{'SQLAvailabilityGroupAddReplica': | ||
|
||
dsc_sqlagreplica{'SQLAvailabilityGroupAddReplica': | ||
dsc_ensure => 'Present', | ||
dsc_name => $hostname, | ||
dsc_availabilitygroupname => $clusterName, | ||
dsc_sqlserver => $hostname, | ||
dsc_sqlinstancename => 'MSSQLSERVER', | ||
dsc_primaryreplicasqlserver => $clusterName, | ||
dsc_primaryreplicasqlinstancename => 'MSSQLSERVER', | ||
dsc_servername => $hostname, | ||
dsc_instancename => 'MSSQLSERVER', | ||
dsc_primaryreplicaservername => $clusterName, | ||
dsc_primaryreplicainstancename => 'MSSQLSERVER', | ||
dsc_endpointhostname => $hostname, | ||
dsc_psdscrunascredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password}, | ||
require => [ Dsc_xsqlserveralwaysonservice['EnableAlwaysOn'] , Dsc_xsqlserverendpoint['SQLServerEndpoint'] ] | ||
require => [ Dsc_sqlalwaysonservice['EnableAlwaysOn'] , Dsc_sqlserverendpoint['SQLServerEndpoint'] ] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
class sqlserveralwayson::clusterconfig inherits sqlserveralwayson { | ||
|
||
if ( $role == 'primary' ) { | ||
#Failover cluster creation | ||
dsc_xcluster{'CreateFailoverCluster': | ||
dsc_name => $clusterName, | ||
dsc_staticipaddress => $clusterIP, | ||
dsc_domainadministratorcredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
} | ||
#File share whitness configuration | ||
#Warning, bug https://github.com/PowerShell/xFailOverCluster/issues/35 on Windows 2016 | ||
dsc_xclusterquorum{'SetQuorumToNodeAndDiskMajority': | ||
dsc_issingleinstance => 'Yes', | ||
dsc_type => 'NodeAndFileShareMajority', | ||
dsc_resource => $fileShareWitness, | ||
require => Dsc_xcluster['CreateFailoverCluster'] | ||
} | ||
} | ||
else { | ||
dsc_xwaitforcluster{'SecondaryReplicaWaitForCluster': | ||
dsc_name => $clusterName, | ||
dsc_retryintervalsec => 10, | ||
#Failover cluster creation | ||
dsc_xcluster{'CreateFailoverCluster': | ||
dsc_name => $clusterName, | ||
dsc_staticipaddress => $clusterIP, | ||
dsc_domainadministratorcredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password} | ||
} | ||
|
||
#File share whitness configuration | ||
#Warning, bug https://github.com/PowerShell/xFailOverCluster/issues/35 on Windows 2016 | ||
dsc_xclusterquorum{'SetQuorumToNodeAndDiskMajority': | ||
dsc_issingleinstance => 'Yes', | ||
dsc_type => 'NodeAndFileShareMajority', | ||
dsc_resource => $fileShareWitness, | ||
require => Dsc_xcluster['CreateFailoverCluster'] | ||
} | ||
|
||
} | ||
else { | ||
dsc_xwaitforcluster{'SecondaryReplicaWaitForCluster': | ||
dsc_name => $clusterName, | ||
dsc_retryintervalsec => 10, | ||
dsc_retrycount => 6 | ||
} | ||
dsc_xcluster{'JoinCluster': | ||
dsc_name => $clusterName, | ||
} | ||
|
||
dsc_xcluster{'JoinCluster': | ||
dsc_name => $clusterName, | ||
dsc_staticipaddress => $clusterIP, | ||
dsc_domainadministratorcredential => {'user' => $setup_svc_username, 'password' => $setup_svc_password}, | ||
require => Dsc_xwaitforcluster['SecondaryReplicaWaitForCluster'] | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.