Ansible Ping-Pong Architecture

TechOps Examples

Hey — It's Govardhana MK 👋

Along with a use case deep dive, we identify the top news, tools, videos, and articles in the TechOps industry.

IN TODAY'S EDITION

🧠 Use Case

  • Ansible Ping-Pong Architecture

🚀 Top News

📽️ Videos

📚️ Resources

🛠️ TOOL OF THE DAY

cloudwatch-log-redirector -  handy command-line tool helps you capture the logs from your applications and redirect them to AWS CloudWatch Logs.

🧠 USE CASE

Ansible Ping-Pong Architecture

Normal Ping output:

> ping 192.168.0.100

PING 192.168.0.100 (192.168.0.100): 56 data bytes

64 bytes from 192.168.0.100: icmp_seq=0 ttl=64 time=0.047 ms

64 bytes from 192.168.0.100: icmp_seq=1 ttl=64 time=0.056 ms

64 bytes from 192.168.0.100: icmp_seq=2 ttl=64 time=0.045 ms

Ansible Ping output:

> ansible 192.168.0.100 -m ping

> 192.168.0.100 | SUCCESS => {

"changed": false,

  "ping": "pong"

}

Have you ever wondered why it is different?

The normal ping uses ICMP to check network connectivity, while Ansible's ping is a module that ensures connectivity by running Python on the remote host and returning a "pong" message.

It's more of a connectivity and system readiness check rather than just a network test.

The Ansible directory structure plays a role too.

Ansible Directory Structure

  • The ping module lives inside /etc/ansible/ansible_plugins/modules/, where all modules reside.

  • Ansible stores key configurations in ansible.cfg and manages hosts via hosts.ini under the inventory directory.

  • Once you run the ping module, Ansible references this structure, ensuring the configuration and host details are in place.

Anisble Ping-Pong Architecture:

  1. The Ansible controller receives the ansible 192.168.0.100 -m ping request.

  2. It checks the hosts.ini file in the inventory to find the target host (192.168.0.100).

  3. The ping module (ansible.builtin.ping) is triggered from the modules directory.

  4. The ping module establishes an SSH connection and sends the "PING packet" to the target host.

  5. If the target host is reachable, it sends a "PONG packet" back to the controller via SSH.

  6. The Ansible controller displays the success message, showing "ping": "pong".

Some of the less-known ping types you should understand:

Flood Ping

Sends packets as fast as possible, useful for stress testing or debugging.

ping -f 192.168.1.1

Ping with a Set Number of Requests

Limits the number of ping requests sent.

ping -c 4 192.168.1.1

TTL Ping

Limits the Time To Live (TTL) value of a packet, often used in debugging routing loops or traceroute.

ping -t 5 192.168.1.1

Ping Broadcast

Pings every host on the local network.

ping -b 192.168.1.255

Reverse Ping (Windows)

Windows-specific, checks if another host can ping your machine.

ping -r 9 192.168.1.1

Hope this was useful and it's always interesting to see the behind-the-scenes for a stronger understanding!

Over the past 17+ years, I’ve led millions of dollars' worth of digital and cloud transformation projects for 40+ clients, including:

I can help you kickstart your digital and cloud transformation or optimize your existing systems to make them more efficient, scalable, and future-ready.

Whenever you’re ready for that, book a call.

Looking to promote your company, product, service, or event to 16,000+ TechOps Professionals? Let's work together.