Ping module with Ansible

From Knowledge Center
Jump to: navigation, search

The ping module allows you to test if you can reach the destination server

Inventory

inventory.ini

[test]
172.31.91.233

[test:vars]
ansible_user = ubuntu
ansible_ssh_private_key_file = ~/.ssh/id_rsa
ansible_python_interpreter=/usr/bin/python3

Ping

Test the ping module:

ansible -i inventory.ini test -m ping
172.31.91.233 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}