Long story short, stateless auto deploy environment, 150+ hosts, hostd is crashing and filling up /var/core on the local partition. VMware support has instructed us to redirect /var/core directory to an external datastore. So..
1 - I have already created all the directories (ie /vmfs/volumes/datastore/coredumps/hostname)
2 - I need to see if I can script this for each host:
rm /var/core
ln -s /vmfs/volumes/datastore/coredumps/hostname /var/core
Also, if I have to do this manually, last resort, is there a way to script enabling SSH on all hosts?
Thanks in advance
Install-Module Posh-SSH
Import-Module Posh-SSH
$ESXiRootCreds = Get-Credential
$VMHosts = Get-VMHost
Foreach ($VMHost in $VMHosts){
$VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService -confirm:$False
New-SSHSession -computername $VMHost.Name -Credential $ESXiRootCreds
Invoke-SSHCommand -SessionId 0 -Command "rm /var/core"
Invoke-SSHCommand -SessionId 0 -Command "ln -s /vmfs/volumes/datastore/coredumps/$($VMHost.Name) /var/core"
Invoke-SSHCommand -SessionId 0 -Command "logout"
Remove-SSHSession 0
$VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService -confirm:$False
}
Install-Module Posh-SSH
Import-Module Posh-SSH
$ESXiRootCreds = Get-Credential
$VMHosts = Get-VMHost
Foreach ($VMHost in $VMHosts){
$VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Start-VMHostService -confirm:$False
New-SSHSession -computername $VMHost.Name -Credential $ESXiRootCreds
Invoke-SSHCommand -SessionId 0 -Command "rm /var/core"
Invoke-SSHCommand -SessionId 0 -Command "ln -s /vmfs/volumes/datastore/coredumps/$($VMHost.Name) /var/core"
Invoke-SSHCommand -SessionId 0 -Command "logout"
Remove-SSHSession 0
$VMHost | Get-VMHostService | Where {$_.Key -eq "TSM-SSH"} | Stop-VMHostService -confirm:$False
}