mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
win_ping: Make full-functional
Small cleanup and backport `ping` functionality.
This commit is contained in:
parent
4d57515aec
commit
a60c051952
2 changed files with 16 additions and 8 deletions
|
@ -17,13 +17,19 @@
|
||||||
# WANT_JSON
|
# WANT_JSON
|
||||||
# POWERSHELL_COMMON
|
# POWERSHELL_COMMON
|
||||||
|
|
||||||
$params = Parse-Args $args $true;
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
$data = Get-Attr $params "data" "pong";
|
$params = Parse-Args $args -supports_check_mode $true
|
||||||
|
|
||||||
$result = New-Object psobject @{
|
$data = Get-AnsibleParam -obj $params -name "data" -type "str" -default "pong"
|
||||||
|
|
||||||
|
if ($data -eq "crash") {
|
||||||
|
throw "boom"
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = @{
|
||||||
changed = $false
|
changed = $false
|
||||||
ping = $data
|
ping = $data
|
||||||
};
|
}
|
||||||
|
|
||||||
Exit-Json $result;
|
Exit-Json $result
|
||||||
|
|
|
@ -36,9 +36,7 @@ options:
|
||||||
data:
|
data:
|
||||||
description:
|
description:
|
||||||
- Alternate data to return instead of 'pong'
|
- Alternate data to return instead of 'pong'
|
||||||
required: false
|
|
||||||
default: 'pong'
|
default: 'pong'
|
||||||
aliases: []
|
|
||||||
author: "Chris Church (@cchurch)"
|
author: "Chris Church (@cchurch)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -47,6 +45,10 @@ EXAMPLES = r'''
|
||||||
ansible winserver -m win_ping
|
ansible winserver -m win_ping
|
||||||
|
|
||||||
# Example from an Ansible Playbook
|
# Example from an Ansible Playbook
|
||||||
- action: win_ping
|
- win_ping:
|
||||||
|
|
||||||
|
# Induce a crash to see what happens
|
||||||
|
- win_ping:
|
||||||
|
data: crash
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue