ping – Try to connect to host, verify a usable python and return pong on success

From Get docs
Ansible/docs/2.7/modules/ping module


ping – Try to connect to host, verify a usable python and return pong on success

Synopsis

  • A trivial test module, this module always returns pong on successful contact. It does not make sense in playbooks, but it is useful from /usr/bin/ansible to verify the ability to login and that a usable Python is configured.
  • This is NOT ICMP ping, this is just a trivial test module that requires Python on the remote-node.
  • For Windows targets, use the win_ping module instead.
  • For Network targets, use the net_ping module instead.

Parameters

Parameter Choices/Defaults Comments

data

-

Default:

"pong"

Data to return for the ping return value.

If this parameter is set to crash, the module will cause an exception.



Notes

Note

  • For Windows targets, use the win_ping module instead.
  • For Network targets, use the net_ping module instead.


Examples

# Test we can logon to 'webservers' and execute python with json lib.
# ansible webservers -m ping

# Example from an Ansible Playbook
- ping:

# Induce an exception to see what happens
- ping:
    data: crash

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description

ping

string

success

value provided with the data parameter


Sample:

pong




Status

Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

Authors

  • Ansible Core Team
  • Michael DeHaan

Hint

If you notice any issues in this documentation you can edit this document to improve it.


© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/ping_module.html