platforms/qemu and platforms/proxmox each have their own lab.sh and lab.conf; content/ holds everything shared (roles, seed, site, helpers). The dispatcher, preflight and command implementations are common and take platform differences from the backend. Proxmox backend: qm create with q35/SATA/e1000, ISOs and seed ISOs in an ISO storage, provisioning over qm guest exec (no Python packages needed on the host), template + clone for reset, and peers/ to emit WireGuard configs. The role scripts now ride on the seed ISO, so provisioning transfers nothing. build-bundle.sh produces a self-contained tarball per platform, for hosts that cannot reach the git server. Both configs are generic: no absolute path from this machine remains.
41 lines
1.3 KiB
PowerShell
41 lines
1.3 KiB
PowerShell
# Norbourg lab — DC01 stage 1: install AD DS and create the forest.
|
|
# Promotion reboots the machine, so the account/ACL work lives in dc01-post.ps1
|
|
# and is scheduled as a startup task before the reboot.
|
|
|
|
. "$PSScriptRoot\..\lib\common.ps1"
|
|
|
|
$self = $PSCommandPath
|
|
Write-LabLog 'dc01: stage 1 starting'
|
|
|
|
try {
|
|
# Re-running provision must not try to promote a server that already is one.
|
|
if ((Get-Service NTDS -ErrorAction SilentlyContinue).Status -eq 'Running') {
|
|
Complete-Stage $self 'ok already-dc'
|
|
return
|
|
}
|
|
|
|
$feature = Get-WindowsFeature -Name AD-Domain-Services
|
|
if (-not $feature.Installed) {
|
|
Write-LabLog 'dc01: installing AD-Domain-Services'
|
|
$null = Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
|
|
} else {
|
|
Write-LabLog 'dc01: AD-Domain-Services already installed'
|
|
}
|
|
|
|
$safeMode = ConvertTo-SecureString '@@SAFE_MODE_PASSWORD@@' -AsPlainText -Force
|
|
|
|
Write-LabLog 'dc01: creating forest norbourg.lab'
|
|
$null = Install-ADDSForest `
|
|
-DomainName '@@DOMAIN@@' `
|
|
-DomainNetbiosName '@@NETBIOS@@' `
|
|
-InstallDns `
|
|
-SafeModeAdministratorPassword $safeMode `
|
|
-NoRebootOnCompletion `
|
|
-Force
|
|
|
|
Complete-Stage $self 'ok reboot'
|
|
Restart-Computer -Force
|
|
} catch {
|
|
Fail-Stage $self $_.Exception.Message
|
|
}
|