How to Build Ansible Inventory for Scalable Infrastructure

In partnership with

TechOps Examples

Hey — It's Govardhana MK 👋

Welcome to another technical edition.

Every Tuesday – You’ll receive a free edition with a byte-size use case, remote job opportunities, top news, tools, and articles.

Every Thursday and Saturday – You’ll receive a special edition with a deep dive use case, remote job opportunities, and articles.

👋 👋 A big thank you to today's sponsor THE HUSTLE DAILY

200+ AI Side Hustles to Start Right Now

While you were debating if AI would take your job, other people started using it to print money. Seriously.

That's not hyperbole. People are literally using ChatGPT to write Etsy descriptions that convert 3x better. Claude to build entire SaaS products without coding. Midjourney to create designs clients pay thousands for.

The Hustle found 200+ ways regular humans are turning AI into income. Subscribe to The Hustle for the full guide and unlock daily business intel that's actually interesting.

👀 Remote Jobs

Powered by: Jobsurface.com

📚️ Resources

Looking to promote your company, product, service, or event to 60,000+ Cloud Native Professionals? Let's work together. Advertise With Us

🧠 DEEP DIVE USE CASE

How to Build Ansible Inventory for Scalable Infrastructure

When you run anything in Ansible, it needs to know which machines to connect to. These machines are listed in what’s called an inventory file. A basic inventory file in INI format can look like this:

You can group servers by purpose, like webservers or databases. The [all:vars] section defines values that apply to every host, like the SSH user and key.

Ansible connects to remote machines over SSH to run tasks. Once the inventory is set, you can run an ansible ping command to verify SSH connectivity and confirm that Ansible can reach the target machine before running any actual tasks.

ansible 192.168.0.100 -m ping

Here’s what actually happens:

  • Ansible CLI receives the command with the target host and ping module

  • It consults the inventory file and loads relevant host details and variables.

  • The Ansible controller uses SSH to connect to the target machine.

  • The ping module is pushed temporarily to the host.

  • The host executes it and sends a JSON response like {"ping": "pong"}.

  • This result is sent back to your terminal, confirming connectivity and configuration.

It’s simple and powerful, but in dynamic environments, static host files don’t scale.

The control node is the machine where you install and run Ansible.

A managed node is any remote machine that Ansible connects to and automates using SSH.

Having understood what an Ansible inventory is and how Ansible uses it to reach machines, let us see how this approach holds up when infrastructure starts changing frequently.

🔴 Get my DevOps & Kubernetes ebooks! (free for Premium Club and Personal Tier newsletter subscribers)

Upgrade to Paid to read the rest.

Become a paying subscriber to get access to this post and other subscriber-only content.

Already a paying subscriber? Sign In.

Paid subscriptions get you:

  • • Access to archive of 250+ use cases
  • • Deep Dive use case editions (Thursdays and Saturdays)
  • • Access to Private Discord Community
  • • Invitations to monthly Zoom calls for use case discussions and industry leaders meetups
  • • Quarterly 1:1 'Ask Me Anything' power session