2014-06-18 14:32:02 +00:00
|
|
|
#!powershell
|
|
|
|
# This file is part of Ansible
|
|
|
|
#
|
|
|
|
# Ansible is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Ansible is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# WANT_JSON
|
|
|
|
# POWERSHELL_COMMON
|
|
|
|
|
2014-06-18 15:07:46 +00:00
|
|
|
# $params is not currently used in this module
|
|
|
|
# $params = Parse-Args $args;
|
2014-06-18 14:32:02 +00:00
|
|
|
|
|
|
|
$result = New-Object psobject @{
|
|
|
|
ansible_facts = New-Object psobject
|
|
|
|
changed = $false
|
|
|
|
};
|
|
|
|
|
|
|
|
$osversion = [Environment]::OSVersion
|
|
|
|
|
|
|
|
Set-Attr $result.ansible_facts "ansible_hostname" $env:COMPUTERNAME;
|
|
|
|
Set-Attr $result.ansible_facts "ansible_fqdn" "$([System.Net.Dns]::GetHostByName((hostname)).HostName)"
|
2014-06-18 14:36:10 +00:00
|
|
|
Set-Attr $result.ansible_facts "ansible_system" $osversion.Platform.ToString()
|
2014-06-18 14:32:02 +00:00
|
|
|
Set-Attr $result.ansible_facts "ansible_os_family" "Windows"
|
|
|
|
Set-Attr $result.ansible_facts "ansible_distribution" $osversion.VersionString
|
|
|
|
Set-Attr $result.ansible_facts "ansible_distribution_version" $osversion.Version.ToString()
|
|
|
|
|
|
|
|
echo $result | ConvertTo-Json;
|