From d65ab2c9dba78bfaea90057ebc986c2f76b66ec8 Mon Sep 17 00:00:00 2001 From: glattercj Date: Sat, 9 Sep 2023 16:03:08 -0600 Subject: [PATCH] Add a startup script delay to annotated domain controllers --- src/go/tmpl/templates/windows_startup.tmpl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/go/tmpl/templates/windows_startup.tmpl b/src/go/tmpl/templates/windows_startup.tmpl index 6a45733b..6f328a24 100644 --- a/src/go/tmpl/templates/windows_startup.tmpl +++ b/src/go/tmpl/templates/windows_startup.tmpl @@ -1,3 +1,18 @@ +{{ $dc := index .Node.Annotations "phenix/domain-controller" }} + +{{ if toBool $dc }} +while ($true) { + try { + Get-ADDomain | Out-Null + Write-Host "[+] Domain Controller services ready!" + break + } catch { + Write-Host "[-] Waiting for Domain Controller services to be ready..." + Start-Sleep -Seconds 20 + } +} +{{ end }} + function Phenix-SetStartupStatus($status) { echo "Marking phenix startup as $status in registry..."