I have been working on the FailoverClusterDsc resource module and finally had the chance to add some examples and make the repository public.
This is not a fork of the xFailoverCluster module. I am adding only the resources that I am developing from scratch to this module. These resources will follow the HQRM guidelines.
Resources in this module
Resource Name | Description |
---|---|
FailoverCluster | Creates a failover cluster. |
FailoverClusterNode | Adds/removes a node to/from a failover cluster |
FailoverClusterQuorum | Configures a cluster disk/share/node majority quorum. |
FailoverClusterCloudWitness | Configures cloud witness for failover cluster. |
FailoverClusterResourceParameter | Configures a failover cluster resource parameter. |
FailoverClusterS2D | Enables Storage Spaces Direct in a failover cluster. |
WaitForFailoverCluster | Waits until a failover cluster becomes available. |
WaitForFailoverClusterNode | Waits until a node join a failover cluster. |
You can take a look at each of these resources to check what different configuration options are supported as of today.
Here is an example of creating and configuring a Storage Spaces Direct cluster.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
$configData = @{ AllNodes = @( @{ NodeName = 'localhost' thumbprint = '25A1359A27FB3F2D562D7508D98E7189F2A1F1B0' CertificateFile = 'C:\PublicKeys\S2D4N01.cer' PsDscAllowDomainUser = $true } ) } Configuration CreateS2DCluster { param ( [Parameter(Mandatory = $true)] [pscredential] $Credential, [Parameter(Mandatory = $true)] [String[]] $ParticipantNodes, [Parameter(Mandatory = $true)] [String] $ClusterName, [Parameter(Mandatory = $true)] [String] $StaticAddress, [Parameter(Mandatory = $true)] [String[]] $IgnoreNetworks, [Parameter(Mandatory = $true)] [String] $QuorumResource, [Parameter(Mandatory = $true)] [String] $QuorumType ) Import-DscResource -ModuleName FailoverClusterDsc Node $AllNodes.NodeName { FailoverCluster CreateCluster { ClusterName = $ClusterName StaticAddress = $StaticAddress NoStorage = $true IgnoreNetwork = $IgnoreNetworks Ensure = 'Present' PsDscRunAsCredential = $Credential } WaitForFailoverCluster WaitForCluster { ClusterName = $ClusterName PsDscRunAsCredential = $Credential } Foreach ($node in $ParticipantNodes) { FailoverClusterNode $node { NodeName = $node ClusterName = $ClusterName PsDscRunAsCredential = $Credential Ensure = 'Present' } } FailoverClusterQuorum FileShareQuorum { IsSingleInstance = 'Yes' QuorumType = $QuorumType Resource = $QuorumResource } FailoverClusterS2D EnableS2D { IsSingleInstance = 'yes' Ensure = 'Present' } } } CreateS2DCluster -Credential (Get-Credential) -ConfigurationData $configData ` -QuorumType 'NodeAndFileShareMajority' ` -QuorumResource '\\sofs\share' ` -ClusterName 'S2D4NCluster' ` -StaticAddress '172.16.102.45' ` -IgnoreNetworks @('172.16.103.0/24','172.16.104.0/24') ` -ParticipantNodes @('S2D4N02','S2D4N03','S2D4N04') |
In the above pattern, I am creating a failover cluster and then adding the remaining nodes using the same configuration document. You can, however, have the node addition configuration using the FailoverClusterNode resource as a separate configuration document that gets enacted on the participant node.
The failover cluster configuration requires administrator privileges and these resources do not have a Credential parameter of their own and depend on PSDscRunAsCredential. Therefore, you need at least PowerShell 5.0 to use these resources.
I am looking at expanding the resource modules to beyond what is there at the moment. If you see any issues or have feedback, feel free to create an issue in my repository. These resources lack tests today. I would be glad to accept any PRs for tests.