0Pricing
Ansible Academy · Lesson

Ping a Host with the ping Module

Confirm connectivity using your first module.

Ping a Host with the ping Module is a free Ansible Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Your First Module

The ping module is Ansible's hello world. It proves Ansible can reach a host and run Python there, end to end.

Not ICMP Ping

Despite the name, it is not an ICMP network ping. It connects over SSH, then confirms Python responds on the managed node.

The Ad-Hoc Form

Run it as an ad-hoc command: name the hosts, then -m ping. No playbook file is needed for this quick test.

ansible all -m ping

Read the Pattern

The word before -m is the pattern. Here all means every host in your inventory; you could also target one group.

ansible web -m ping

The -m Flag

The -m flag picks the module to run. Swapping ping for another module is how ad-hoc commands do real work later.

A Successful Pong

Success looks like pong. Ansible prints SUCCESS and "ping": "pong" for each host it reached cleanly. 🏓

web1 | SUCCESS => {
  "ping": "pong"
}

When It Fails

A UNREACHABLE result means SSH could not connect, often wrong key, user, or host. Fix login before blaming Ansible.

Point at an Inventory

If you skipped ansible.cfg, add -i to name your inventory file so Ansible knows which hosts the pattern refers to.

ansible all -i hosts -m ping

Try One Host

Target a single machine by naming it as the pattern. This isolates one server when you are debugging connectivity.

ansible web1 -m ping

Localhost Counts

You can even ping localhost with a local connection. It is a fast way to confirm Ansible itself runs correctly.

ansible localhost -m ping

The Connectivity Gate

A green pong across your inventory means every node is reachable. That is the green light to start writing real automation. ✅

Quick Check

Final check for this course.

Recap

The ping module verifies SSH plus Python reachability, returning pong on success. It is your go-to connectivity test before automating. 🎉

Frequently asked questions

Is the “Ping a Host with the ping Module” lesson free?

Yes — the full text of “Ping a Host with the ping Module” is free to read here on the web, and the Ansible Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO.

What will I learn in “Ping a Host with the ping Module”?

Confirm connectivity using your first module. You practise Ansible Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Ansible Academy?

No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Ping a Host with the ping Module” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Ansible Academy lesson?

Yes. Every Ansible Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Installing the Ansible Control Node
  2. SSH Keys & Passwordless Login
  3. Your ansible.cfg: Sensible Defaults
  4. Ping a Host with the ping Module
← Back to Ansible Academy