Task 10: Configure Hostname
Status: Active | Estimated Time: 5 minutes per node | Last Updated: 2026-03-04
Overview
Rename each node to its target hostname from variables.yml. Nodes must restart to apply the change.
Prerequisites
| Requirement | Details |
|---|---|
| Tasks 01–09 complete | Unused adapters disabled |
| Hostnames from variables.yml | cluster_nodes[].hostname |
Config Reference
| YAML Key | Variable | Example |
|---|---|---|
cluster_nodes[].hostname | $NewHostname | azlocal-node01 |
cluster_nodes[].management_ip | $ServerList / $node.ip | 10.0.0.11 |
Execution Options
- SConfig (Recommended)
- Direct (On Node)
- Orchestrated (Mgmt Server)
Run on each node via console, KVM, or RDP. SConfig is the simplest method.
- At the PowerShell prompt, type
SConfigand press Enter - Select option 2 — Computer Name
- Type the hostname from
variables.yml(cluster_nodes[].hostname) - Press Enter and confirm
- Select Yes to restart now
Repeat on each node.
Run on each node individually via console, KVM, or RDP.
Toolkit script: scripts/deploy/04-cluster-deployment/phase-03-os-configuration/task-10-configure-hostname/powershell/Set-NodeHostname.ps1
$NewHostname = "REPLACE_WITH_HOSTNAME" # cluster_nodes[].hostname
if ($NewHostname -match "^REPLACE_") {
Write-Host "[ERROR] Set `$NewHostname before running" -ForegroundColor Red; exit 1
}
Rename-Computer -NewName $NewHostname -Force
Write-Host "[PASS] Hostname set. Restart required." -ForegroundColor Green
Restart-Computer -Force
Run from the management server. Reads all node IPs and hostnames from variables.yml, renames each node, restarts it, and waits for it to come back online.
Toolkit script: scripts/deploy/04-cluster-deployment/phase-03-os-configuration/task-10-configure-hostname/powershell/Invoke-ConfigureHostname-Orchestrated.ps1
# Task 10 - Configure Hostname (orchestrated, all nodes)
# variables.yml variables:
# cluster_nodes[].management_ip -> connection IP per node
# cluster_nodes[].hostname -> target hostname per node
$ConfigPath = "$env:USERPROFILE\variables.yml"
$lines = Get-Content $ConfigPath
$nodes = @()
$current = $null
foreach ($line in $lines) {
if ($line -match '^\s*-\s*hostname:\s*"?([^"]+)"?') { $current = @{ hostname = $Matches[1].Trim(); ip = "" } }
elseif ($line -match '^\s+management_ip:\s*"?([^"]+)"?' -and $current) { $current.ip = $Matches[1].Trim() }
if ($current -and $current.ip -and $current.hostname) { $nodes += [PSCustomObject]$current; $current = $null }
}
foreach ($node in $nodes) {
Invoke-Command -ComputerName $node.ip -ArgumentList $node.hostname -ScriptBlock {
param($name)
Rename-Computer -NewName $name -Force
}
Restart-Computer -ComputerName $node.ip -Force
Write-Host "[$($node.ip)] Renamed to $($node.hostname) -- restarting"
}
Write-Host "Waiting 60s for nodes to come back online..."
Start-Sleep -Seconds 60
foreach ($node in $nodes) {
$reported = Invoke-Command -ComputerName $node.ip -ScriptBlock { $env:COMPUTERNAME }
Write-Host "[$($node.ip)] Online - hostname: $reported"
}
Validation
# Confirm hostname on each node
$env:COMPUTERNAME
# or remotely:
Invoke-Command -ComputerName <ip> -ScriptBlock { $env:COMPUTERNAME }
Validation Checklist
- Each node reports the correct hostname
- All nodes accessible after restart
- Hostnames match
cluster_nodes[].hostnamein variables.yml
Troubleshooting
| Issue | Resolution |
|---|---|
| Node didn't come back after restart | Wait another 60s then ping the management IP |
| Hostname not applied | Confirm Rename-Computer ran without error; restart if needed |
Navigation
← Task 09: Disable Adapters · ↑ Phase 03 · Task 11: Clear Storage →