AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Configure Ansible Dynamic Inventory for VMware in Simple Steps

By Luca Berton · Published 2024-01-01 · Category: linux-administration

Discover how to configure Ansible Dynamic Inventory for VMware to automate and manage virtual machines efficiently. Step-by-step guide with Playbook included.

Introduction

This guide shows you the best way to list all the virtual machines within your VMware infrastructure using Ansible. I'll provide a live Playbook and some simple Ansible code. Welcome to today's episode of Ansible Pilot—I'm Luca Berton.

Ansible Dynamic Inventory for VMwareFunctionality: Dynamically retrieves virtual machines as inventory hosts from the VMware environment. • Plugin: community.vmware.vmware_vm_inventory • Dependencies: Python pyVmomi, requests, and vSphere Automation SDK

The VMware dynamic inventory plugin interacts with VMware APIs to dynamically manage nodes with Ansible. The community.vmware.vmware_vm_inventory plugin, part of the community-supported collection, allows you to run Ansible automation across your VMware virtual machines.

Linkscommunity.vmware.vmware_vm_inventory

Demo Let’s configure Ansible Dynamic Inventory for VMware to list all virtual machines in your VMware infrastructure as an Ansible inventory.

Configuration Filesansible.cfg: • inventory.vmware.yml:

Listing HostsCommand: • Output:

Graphing HostsCommand: • Output:

Code with ❤️ on GitHub

Conclusion

Now you know how to configure Ansible Dynamic Inventory for VMware, enabling you to automate and manage your VMware virtual machines efficiently.

Related ArticlesAnsible Inventory Guide

Category: linux-administration

Watch the video: Configure Ansible Dynamic Inventory for VMware in Simple Steps — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home