Skip to content

Commit

Permalink
Changes to xFailOverCluster
Browse files Browse the repository at this point in the history
  - 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
johlju committed Jun 17, 2017
1 parent d364b10 commit 73b44cf
Show file tree
Hide file tree
Showing 6 changed files with 311 additions and 149 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
- Added CodeCov and opt-in for all common tests (issue #41).
- Added CodeCov badge to README.md
- Fixed lint rule MD013 in CHANGELOG.md.
- Removed example from README.md (issue #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

### 1.6.0.0

Expand Down
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'
}
}
}
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 Examples/Resources/xCluster/3-CreateFailoverClusterWithTwoNodes.ps1
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'
}
}
}
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'
}
}
}

0 comments on commit 73b44cf

Please sign in to comment.