Skip to content

Commit

Permalink
Merge pull request #102 from woodp/sap-azbb
Browse files Browse the repository at this point in the history
SAP Hana with azbb v2 and DSC
  • Loading branch information
Petertaylor9999 authored Jan 9, 2018
2 parents b49bfd0 + 4db5762 commit d970ad7
Show file tree
Hide file tree
Showing 5 changed files with 1,002 additions and 0 deletions.
130 changes: 130 additions & 0 deletions sap/sap-hana-v2/adds-forest.ps1
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"
}
}
}
133 changes: 133 additions & 0 deletions sap/sap-hana-v2/adds.ps1
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 added sap/sap-hana-v2/adds.zip
Binary file not shown.
Loading

0 comments on commit d970ad7

Please sign in to comment.