forked from dsccommunity/FailoverClusterDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed example from README.md (issue dsccommunity#42). Changes to xCluster - Added examples - 1-CreateFirstNodeOfAFailoverCluster.ps1 - 2-JoinAdditionalNodeToFailoverCluster.ps1 - 3-CreateFailoverClusterWithTwoNodes.ps1 (this is the example from README.md) Changes to xWaitForCluster - Added example - 1-WaitForFailoverClusterToBePresent.ps1
- Loading branch information
Showing
6 changed files
with
311 additions
and
149 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
52 changes: 52 additions & 0 deletions
52
Examples/Resources/xCluster/1-CreateFirstNodeOfAFailoverCluster.ps1
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,52 @@ | ||
<# | ||
.EXAMPLE | ||
This example shows how to create the a failover cluster on the first node. | ||
#> | ||
|
||
Configuration Example | ||
{ | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[PSCredential] | ||
$ActiveDirectoryAdministratorCredential | ||
) | ||
|
||
Import-DscResource -ModuleName xFailOverCluster | ||
|
||
Node localhost | ||
{ | ||
WindowsFeature AddFailoverFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Failover-clustering' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringPowerShellFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-PowerShell' | ||
DependsOn = '[WindowsFeature]AddFailoverFeature' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-CmdInterface' | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringPowerShellFeature' | ||
} | ||
|
||
xCluster CreateCluster | ||
{ | ||
Name = 'Cluster01' | ||
StaticIPAddress = '192.168.100.20/24' | ||
|
||
<# | ||
This user must have the permission to create the CNO (Cluster Name Object) in Active Directory, | ||
unless it is prestaged. | ||
#> | ||
DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential | ||
|
||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature' | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Examples/Resources/xCluster/2-JoinAdditionalNodeToFailoverCluster.ps1
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,54 @@ | ||
<# | ||
.EXAMPLE | ||
This example shows how to add an additional node to the a failover cluster. | ||
#> | ||
|
||
Configuration Example | ||
{ | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[PSCredential] | ||
$ActiveDirectoryAdministratorCredential | ||
) | ||
|
||
Import-DscResource -ModuleName xFailOverCluster | ||
|
||
Node localhost | ||
{ | ||
WindowsFeature AddFailoverFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Failover-clustering' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringPowerShellFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-PowerShell' | ||
DependsOn = '[WindowsFeature]AddFailoverFeature' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-CmdInterface' | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringPowerShellFeature' | ||
} | ||
|
||
xWaitForCluster WaitForCluster | ||
{ | ||
Name = 'Cluster01' | ||
RetryIntervalSec = 10 | ||
RetryCount = 60 | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature' | ||
} | ||
|
||
xCluster JoinSecondNodeToCluster | ||
{ | ||
Name = 'Cluster01' | ||
StaticIPAddress = '192.168.100.20/24' | ||
DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential | ||
DependsOn = '[xWaitForCluster]WaitForCluster' | ||
} | ||
} | ||
} |
139 changes: 139 additions & 0 deletions
139
Examples/Resources/xCluster/3-CreateFailoverClusterWithTwoNodes.ps1
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,139 @@ | ||
<# | ||
.EXAMPLE | ||
In this example, we will create a failover cluster with two servers. | ||
We will assume that a Domain Controller already exists, and that both VMs are already domain joined. | ||
Furthermore, the example assumes that your certificates are installed such that DSC can appropriately | ||
handle secrets such as the Active Directory administrator credential. The example also assumes that | ||
the CNO (Cluster Name Object) is either prestaged or that the Active Directory administrator credential | ||
has the appropriate permission to create the CNO (Cluster Name Object). | ||
#> | ||
|
||
$ConfigurationData = @{ | ||
AllNodes = @( | ||
@{ | ||
NodeName= '*' | ||
|
||
# Use your own public certificate of the same certificate that are installed on the target nodes. | ||
CertificateFile = 'C:\Certificates\DscDemo.cer' | ||
|
||
<# | ||
Replace with the thumbprint of certificate that are installed on both the target nodes. | ||
This must be the private certificate of the same public certificate used in the previous | ||
parameter CertificateFile. | ||
For this example it is assumed that both machines have the same certificate installed. | ||
#> | ||
Thumbprint = "E513EEFCB763E6954C52BA66A1A81231BF3F551E" | ||
|
||
<# | ||
Replace with your own CNO (Cluster Name Object) and IP address. | ||
Please note that if the CNO is prestaged, then the computer object must be disabled for the | ||
resource xCluster to be able to create the cluster. | ||
If the CNO is not prestaged, then the credential used in the xCluster resource must have | ||
the permission in Active Directory to create the CNO (Cluster Name Object). | ||
#> | ||
ClusterName = 'Cluster01' | ||
ClusterIPAddress = '192.168.100.20/24' | ||
}, | ||
|
||
# Node01 - First cluster node. | ||
@{ | ||
# Replace with the name of the actual target node. | ||
NodeName= 'Node01' | ||
|
||
# This is used in the configuration to know which resource to compile. | ||
Role = 'FirstServerNode' | ||
}, | ||
|
||
# Node02 - Second cluster node | ||
@{ | ||
# Replace with the name of the actual target node. | ||
NodeName= 'Node02' | ||
|
||
# This is used in the configuration to know which resource to compile. | ||
Role = 'AdditionalServerNode' | ||
} | ||
) | ||
} | ||
|
||
Configuration Example | ||
{ | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[PSCredential] | ||
$ActiveDirectoryAdministratorCredential | ||
) | ||
|
||
Import-DscResource -ModuleName xFailOverCluster | ||
|
||
Node $AllNodes.Where{$_.Role -eq 'FirstServerNode' }.NodeName | ||
{ | ||
WindowsFeature AddFailoverFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Failover-clustering' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringPowerShellFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-PowerShell' | ||
DependsOn = '[WindowsFeature]AddFailoverFeature' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-CmdInterface' | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringPowerShellFeature' | ||
} | ||
|
||
xCluster CreateCluster | ||
{ | ||
Name = $Node.ClusterName | ||
StaticIPAddress = $Node.ClusterIPAddress | ||
# This user must have the permission to create the CNO (Cluster Name Object) in Active Directory, unless it is prestaged. | ||
DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature' | ||
} | ||
} | ||
|
||
Node $AllNodes.Where{ $_.Role -eq 'AdditionalServerNode' }.NodeName | ||
{ | ||
WindowsFeature AddFailoverFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Failover-clustering' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringPowerShellFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-PowerShell' | ||
DependsOn = '[WindowsFeature]AddFailoverFeature' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-CmdInterface' | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringPowerShellFeature' | ||
} | ||
|
||
xWaitForCluster WaitForCluster | ||
{ | ||
Name = $Node.ClusterName | ||
RetryIntervalSec = 10 | ||
RetryCount = 60 | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature' | ||
} | ||
|
||
xCluster JoinSecondNodeToCluster | ||
{ | ||
Name = $Node.ClusterName | ||
StaticIPAddress = $Node.ClusterIPAddress | ||
DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential | ||
DependsOn = '[xWaitForCluster]WaitForCluster' | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
Examples/Resources/xWaitForCluster/1-WaitForFailoverClusterToBePresent.ps1
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,57 @@ | ||
<# | ||
.EXAMPLE | ||
This example shows how to watif or the failover cluster to be present. For example | ||
if the failover cluster was created on the first node and the second node at the | ||
same time, then second node must wait for the first node to create the cluster. | ||
otherwise both nodes might try to create the same cluster. | ||
#> | ||
|
||
Configuration Example | ||
{ | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[PSCredential] | ||
$ActiveDirectoryAdministratorCredential | ||
) | ||
|
||
Import-DscResource -ModuleName xFailOverCluster | ||
|
||
Node localhost | ||
{ | ||
WindowsFeature AddFailoverFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Failover-clustering' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringPowerShellFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-PowerShell' | ||
DependsOn = '[WindowsFeature]AddFailoverFeature' | ||
} | ||
|
||
WindowsFeature AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature | ||
{ | ||
Ensure = 'Present' | ||
Name = 'RSAT-Clustering-CmdInterface' | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringPowerShellFeature' | ||
} | ||
|
||
xWaitForCluster WaitForCluster | ||
{ | ||
Name = 'Cluster01' | ||
RetryIntervalSec = 10 | ||
RetryCount = 60 | ||
DependsOn = '[WindowsFeature]AddRemoteServerAdministrationToolsClusteringCmdInterfaceFeature' | ||
} | ||
|
||
xCluster JoinSecondNodeToCluster | ||
{ | ||
Name = 'Cluster01' | ||
StaticIPAddress = '192.168.100.20/24' | ||
DomainAdministratorCredential = $ActiveDirectoryAdministratorCredential | ||
DependsOn = '[xWaitForCluster]WaitForCluster' | ||
} | ||
} | ||
} |
Oops, something went wrong.