Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T2 ONR BODS redundancy and shared drive #1155

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion powershell/Scripts/UserDataScripts/OnrBods.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ $GlobalConfig = @{
# "cmsPrimaryNode" = "t2-tst-bods-asg" # Use this value when testing
"cmsSecondaryNode" = "t2-onr-bods-2"
# "cmsSecondaryNode" = "t2-tst-bods-asg" # Use this value when testing
"cmsPrimaryNodeHostname" = "EC2AMAZ-JM52FS3" # ADD MANUALLY AFTER cmsPrimaryNode DEPLOYED
"cmsPrimaryNodeHostname" = "EC2AMAZ-7VGMSLH" # ADDED MANUALLY AFTER cmsPrimaryNode DEPLOYED
"serviceUser" = "svc_nart"
"serviceUserPath" = "OU=Service,OU=Users,OU=NOMS RBAC,DC=AZURE,DC=NOMS,DC=ROOT"
"nartComputersOU" = "OU=Nart,OU=MODERNISATION_PLATFORM_SERVERS,DC=AZURE,DC=NOMS,DC=ROOT"
"serviceUserDescription" = "Onr BODS service user for AWS in AZURE domain"
"domain" = "AZURE"
"sharedDrive" = "amznfsx7aojksot.azure.noms.root"
}
"oasys-national-reporting-preproduction" = @{
"sysDbName" = "PPBOSYS"
Expand All @@ -44,6 +45,7 @@ $GlobalConfig = @{
"nartComputersOU" = "OU=Nart,OU=MODERNISATION_PLATFORM_SERVERS,DC=AZURE,DC=HMPP,DC=ROOT"
"serviceUserDescription" = "Onr BODS service user for AWS in HMPP domain"
"domain" = "HMPP"
"sharedDrive" = ""
}
"oasys-national-reporting-production" = @{
"domain" = "HMPP"
Expand Down Expand Up @@ -286,6 +288,49 @@ function New-TnsOraFile {

}

function New-SharedDriveShortcut {
param (
[Parameter(Mandatory)]
[hashtable]$Config
)

# NOTE: means there's a desktop shortcut that users can click to access the shared drive with their domain credentials if needed

$share = "\\$($Config.sharedDrive)\share"
$shortcutPath = "C:\Users\Public\Desktop\FSDShare.lnk"
$WScriptShell = New-Object -ComObject WScript.Shell
$shortcut = $WScriptShell.CreateShortcut($ShortCutPath)
$shortcut.TargetPath = $share
$Shortcut.IconLocation = $share
$Shortcut.Save()
}

# NOTE: this function isn't used but is included because it 'might' be necessary at some point
# There are challenges making this persistently available for all users without implementing things in Active Directory
# function New-SharedDriveMount {
# param (
# [Parameter(Mandatory)]
# [hashtable]$Config
# )

# $Tags = Get-InstanceTags

# $dbenv = ($Tags | Where-Object { $_.Key -eq "oasys-national-reporting-environment" }).Value
# $svcUserPwd = Get-SecretValue -SecretId "/sap/bods/$dbenv/passwords" -SecretKey "svc_nart" -ErrorAction SilentlyContinue
# $user = "$($Config.domain)\$($Config.serviceUser)"
# $drive = "S:"
# $path = "\\$($Config.sharedDrive)\share"

# $DriveParams = @{
# Wait = $true
# NoNewWindow = $true
# FilePath = "cmd.exe"
# ArgumentList = "/c","net use $drive $path $svcUserPwd /USER:$user /PERSISTENT:YES"
# }

# Start-Process @DriveParams
# }

function Install-Oracle19cClient {
param (
[Parameter(Mandatory)]
Expand Down Expand Up @@ -897,3 +942,5 @@ Test-DbCredentials -Config $Config
Install-IPS -Config $Config
Install-DataServices -Config $Config
Set-LoginText -Config $Config
New-SharedDriveShortcut -Config $Config
# }}}
Loading