* "setup.ps1" - Change $env:COMPUTERNAME to [System.Net.Dns]::GetHostName(), to support non NETBIOS compliant hostnames
* Change method to base on WMI
* changed ansible_domain to use WMI
* Fixed per review
* Fixed dot stuff
* Revert "Fixed dot stuff"
This reverts commit a1d5be00f1
.
* dot stuff
* dot stuff 2.0
* Update setup.ps1
* Wrap this up to go
This commit is contained in:
parent
6c23a8df66
commit
1b5975f17e
2 changed files with 14 additions and 5 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "setup.ps1 - Support non NETBIOS compliant hostnames (https://github.com/ansible/ansible/issues/54550)"
|
|
@ -307,7 +307,13 @@ if($gather_subset.Contains('memory')) {
|
||||||
if($gather_subset.Contains('platform')) {
|
if($gather_subset.Contains('platform')) {
|
||||||
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
|
$win32_cs = Get-LazyCimInstance Win32_ComputerSystem
|
||||||
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
|
$win32_os = Get-LazyCimInstance Win32_OperatingSystem
|
||||||
$ip_props = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()
|
$domain_suffix = $win32_cs.Domain.Substring($win32_cs.Workgroup.length)
|
||||||
|
$fqdn = $win32_cs.DNSHostname
|
||||||
|
|
||||||
|
if( $domain_suffix -ne "")
|
||||||
|
{
|
||||||
|
$fqdn = $win32_cs.DNSHostname + "." + $domain_suffix
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$ansible_reboot_pending = Get-PendingRebootStatus
|
$ansible_reboot_pending = Get-PendingRebootStatus
|
||||||
|
@ -318,11 +324,12 @@ if($gather_subset.Contains('platform')) {
|
||||||
|
|
||||||
$ansible_facts += @{
|
$ansible_facts += @{
|
||||||
ansible_architecture = $win32_os.OSArchitecture
|
ansible_architecture = $win32_os.OSArchitecture
|
||||||
ansible_domain = $ip_props.DomainName
|
ansible_domain = $domain_suffix
|
||||||
ansible_fqdn = ($ip_props.Hostname + "." + $ip_props.DomainName)
|
ansible_fqdn = $fqdn
|
||||||
ansible_hostname = $env:COMPUTERNAME
|
ansible_hostname = $win32_cs.DNSHostname
|
||||||
|
ansible_netbios_name = $win32_cs.Name
|
||||||
ansible_kernel = $osversion.Version.ToString()
|
ansible_kernel = $osversion.Version.ToString()
|
||||||
ansible_nodename = ($ip_props.HostName + "." + $ip_props.DomainName)
|
ansible_nodename = $fqdn
|
||||||
ansible_machine_id = Get-MachineSid
|
ansible_machine_id = Get-MachineSid
|
||||||
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
|
ansible_owner_contact = ([string] $win32_cs.PrimaryOwnerContact)
|
||||||
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
|
ansible_owner_name = ([string] $win32_cs.PrimaryOwnerName)
|
||||||
|
|
Loading…
Reference in a new issue