In this article I will show how to install and configure Ansible to manage VMware infrastructure. I will then demonstrate how you can use Ansible to get information about vSphere nodes using two different methods (REST API and Community.VMware Ansible collection).
For my demonstration I used CentOS Stream 9 as my base OS.
You can download all the code and commands used in this article from my GitHub repository.
Install and Configure Ansible
First we need to install Python3 and then we can proceed to install Ansible:
sudo dnf install python3 python3-devel
pip install ansible