forked from sahebjamee/reference-architectures
-
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.
Merge pull request #102 from woodp/sap-azbb
SAP Hana with azbb v2 and DSC
- Loading branch information
Showing
5 changed files
with
1,002 additions
and
0 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,130 @@ | ||
# $DomainName - FQDN for the Active Directory Domain to create | ||
# $AdminCreds - a PSCredentials object that contains username and password | ||
# that will be assigned to the Domain Administrator account | ||
# $SafeModeAdminCreds - a PSCredentials object that contains the password that will | ||
# be assigned to the Safe Mode Administrator account | ||
# $RetryCount - defines how many retries should be performed while waiting | ||
# for the domain to be provisioned | ||
# $RetryIntervalSec - defines the seconds between each retry to check if the | ||
# domain has been provisioned | ||
Configuration CreateForest { | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential]$AdminCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential]$SafeModeAdminCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[string]$DomainName, | ||
|
||
[Parameter(Mandatory)] | ||
[string]$DomainNetbiosName, | ||
|
||
[Int]$RetryCount=20, | ||
[Int]$RetryIntervalSec=30 | ||
) | ||
|
||
Import-DscResource -ModuleName xStorage, xActiveDirectory, xNetworking, xPendingReboot | ||
|
||
[System.Management.Automation.PSCredential ]$DomainCreds = New-Object System.Management.Automation.PSCredential ("${DomainName}\$($AdminCreds.UserName)", $AdminCreds.Password) | ||
[System.Management.Automation.PSCredential ]$SafeDomainCreds = New-Object System.Management.Automation.PSCredential ("${DomainName}\$($SafeModeAdminCreds.UserName)", $SafeModeAdminCreds.Password) | ||
|
||
$Interface = Get-NetAdapter|Where-Object Name -Like "Ethernet*"|Select-Object -First 1 | ||
$InterfaceAlias = $($Interface.Name) | ||
|
||
Node localhost | ||
{ | ||
LocalConfigurationManager | ||
{ | ||
ActionAfterReboot = 'ContinueConfiguration' | ||
ConfigurationMode = 'ApplyOnly' | ||
RebootNodeIfNeeded = $true | ||
} | ||
|
||
xWaitforDisk Disk2 | ||
{ | ||
DiskId = 2 | ||
RetryIntervalSec = 60 | ||
RetryCount = 20 | ||
} | ||
|
||
xDisk FVolume | ||
{ | ||
DiskId = 2 | ||
DriveLetter = 'F' | ||
FSLabel = 'Data' | ||
FSFormat = 'NTFS' | ||
DependsOn = '[xWaitForDisk]Disk2' | ||
} | ||
|
||
WindowsFeature DNS | ||
{ | ||
Ensure = "Present" | ||
Name = "DNS" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
WindowsFeature RSAT | ||
{ | ||
Ensure = "Present" | ||
Name = "RSAT" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
WindowsFeature ADDSInstall | ||
{ | ||
Ensure = "Present" | ||
Name = "AD-Domain-Services" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
xDnsServerAddress DnsServerAddress | ||
{ | ||
Address = '127.0.0.1' | ||
InterfaceAlias = $InterfaceAlias | ||
AddressFamily = 'IPv4' | ||
DependsOn = "[WindowsFeature]DNS" | ||
} | ||
|
||
xADDomain AddDomain | ||
{ | ||
DomainName = $DomainName | ||
DomainNetbiosName = $DomainNetbiosName | ||
DomainAdministratorCredential = $DomainCreds | ||
SafemodeAdministratorPassword = $SafeDomainCreds | ||
DatabasePath = "F:\Adds\NTDS" | ||
LogPath = "F:\Adds\NTDS" | ||
SysvolPath = "F:\Adds\SYSVOL" | ||
DependsOn = "[xWaitForDisk]Disk2","[WindowsFeature]ADDSInstall","[xDnsServerAddress]DnsServerAddress" | ||
} | ||
|
||
xWaitForADDomain DomainWait | ||
{ | ||
DomainName = $DomainName | ||
DomainUserCredential = $DomainCreds | ||
RetryCount = $RetryCount | ||
RetryIntervalSec = $RetryIntervalSec | ||
RebootRetryCount = 5 | ||
DependsOn = "[xADDomain]AddDomain" | ||
} | ||
|
||
xADDomainController PrimaryDC | ||
{ | ||
DomainName = $DomainName | ||
DomainAdministratorCredential = $DomainCreds | ||
SafemodeAdministratorPassword = $SafeDomainCreds | ||
DatabasePath = "F:\Adds\NTDS" | ||
LogPath = "F:\Adds\NTDS" | ||
SysvolPath = "F:\Adds\SYSVOL" | ||
DependsOn = "[xWaitForADDomain]DomainWait" | ||
} | ||
|
||
xPendingReboot Reboot1 | ||
{ | ||
Name = "RebootServer" | ||
DependsOn = "[xADDomainController]PrimaryDC" | ||
} | ||
} | ||
} |
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,133 @@ | ||
# $DomainName - FQDN for the Active Directory Domain to create | ||
# $AdminCreds - a PSCredentials object that contains username and password | ||
# that will be assigned to the Domain Administrator account | ||
# $SafeModeAdminCreds - a PSCredentials object that contains the password that will | ||
# be assigned to the Safe Mode Administrator account | ||
# $RetryCount - defines how many retries should be performed while waiting | ||
# for the domain to be provisioned | ||
# $RetryIntervalSec - defines the seconds between each retry to check if the | ||
# domain has been provisioned | ||
Configuration CreateDomainController { | ||
param | ||
#v1.4 | ||
( | ||
[Parameter(Mandatory)] | ||
[string]$DomainName, | ||
|
||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential]$AdminCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential]$SafeModeAdminCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[string]$PrimaryDcIpAddress, | ||
|
||
[Parameter(Mandatory)] | ||
[string]$SiteName, | ||
|
||
[Int]$RetryCount=20, | ||
[Int]$RetryIntervalSec=30 | ||
) | ||
|
||
Import-DscResource -ModuleName xStorage, xActiveDirectory, xNetworking, xPendingReboot | ||
|
||
[System.Management.Automation.PSCredential ]$DomainCreds = New-Object System.Management.Automation.PSCredential ("${DomainName}\$($AdminCreds.UserName)", $AdminCreds.Password) | ||
[System.Management.Automation.PSCredential ]$SafeDomainCreds = New-Object System.Management.Automation.PSCredential ("${DomainName}\$($SafeModeAdminCreds.UserName)", $SafeModeAdminCreds.Password) | ||
|
||
$Interface = Get-NetAdapter|Where-Object Name -Like "Ethernet*"|Select-Object -First 1 | ||
$InterfaceAlias = $($Interface.Name) | ||
|
||
Node localhost | ||
{ | ||
LocalConfigurationManager | ||
{ | ||
ActionAfterReboot = 'ContinueConfiguration' | ||
ConfigurationMode = 'ApplyOnly' | ||
RebootNodeIfNeeded = $true | ||
} | ||
|
||
# Allow this machine to find the PDC and its DNS server | ||
Script SetDnsServerAddressToFindPDC | ||
{ | ||
GetScript = {return @{}} | ||
TestScript = {return $false} # Always run the SetScript for this. | ||
SetScript = { Set-DnsClientServerAddress -InterfaceAlias $using:InterfaceAlias -ServerAddresses $using:PrimaryDcIpAddress } | ||
} | ||
|
||
xWaitforDisk Disk2 | ||
{ | ||
DiskId = 2 | ||
RetryIntervalSec = 60 | ||
RetryCount = 60 | ||
} | ||
|
||
xDisk FVolume | ||
{ | ||
DiskId = 2 | ||
DriveLetter = 'F' | ||
FSLabel = 'Data' | ||
FSFormat = 'NTFS' | ||
DependsOn = '[xWaitForDisk]Disk2' | ||
} | ||
|
||
WindowsFeature DNS | ||
{ | ||
Ensure = "Present" | ||
Name = "DNS" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
WindowsFeature RSAT | ||
{ | ||
Ensure = "Present" | ||
Name = "RSAT" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
WindowsFeature ADDSInstall | ||
{ | ||
Ensure = "Present" | ||
Name = "AD-Domain-Services" | ||
IncludeAllSubFeature = $true | ||
} | ||
|
||
xWaitForADDomain WaitForPrimaryDC | ||
{ | ||
DomainName = $DomainName | ||
DomainUserCredential = $DomainAdministratorCredentials | ||
RetryCount = 30 | ||
RetryIntervalSec = 30 | ||
RebootRetryCount = 10 | ||
DependsOn = @("[Script]SetDnsServerAddressToFindPDC") | ||
} | ||
|
||
xADDomainController SecondaryDC | ||
{ | ||
DomainName = $DomainName | ||
DomainAdministratorCredential = $DomainCreds | ||
SafemodeAdministratorPassword = $SafeDomainCreds | ||
SiteName = $SiteName | ||
DatabasePath = "F:\Adds\NTDS" | ||
LogPath = "F:\Adds\NTDS" | ||
SysvolPath = "F:\Adds\SYSVOL" | ||
DependsOn = "[xWaitForADDomain]WaitForPrimaryDC","[xWaitForDisk]Disk2","[WindowsFeature]ADDSInstall" | ||
} | ||
|
||
# Now make sure this computer uses itself as a DNS source | ||
xDnsServerAddress DnsServerAddress | ||
{ | ||
Address = @('127.0.0.1', $PrimaryDcIpAddress) | ||
InterfaceAlias = $InterfaceAlias | ||
AddressFamily = 'IPv4' | ||
DependsOn = "[xADDomainController]SecondaryDC" | ||
} | ||
|
||
xPendingReboot Reboot1 | ||
{ | ||
Name = "RebootServer" | ||
DependsOn = "[xDnsServerAddress]DnsServerAddress" | ||
} | ||
|
||
} | ||
} |
Binary file not shown.
Oops, something went wrong.