Bootstrap FreeKB - Ansible - vmware_vm_inventory inventory plugin
Ansible - vmware_vm_inventory inventory plugin

Updated:   |  Ansible articles

Tasks are run against target servers. Some Ansible documentation refers to the target servers as "hosts".

 

If you are not familiar with static inventory vs. dynamic inventory, and dynamic inventory plugins vs. dynamic inventory scripts, check out Ansible - Getting Started with Dynamic Inventory.


The ansible-doc command can be used to display documentation on the vmware_vm_inventory plugin.

ansible-doc --type inventory --snippet vmware_vm_inventory

 

Before using the vmware_vm_inventory plugin, you must have the following:

  • a VMWare ESXi contoller
  • vCenter

If you do not have pip installed, following the direction in Installing PIP on Linux CentOS. Then, use pip to install pyVmomi, setuptools and vSphere Automation SDK.

pip3 install pyVmomi
pip3 install --upgrade pip setuptools
pip3 install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git

 

The pip list command can be used to ensure the packages were installed.

pip3 list

Package                            Version
---------------------------------- ------------------
ansible                            2.9.12
certifi                            2020.6.20
cffi                               1.14.2
chardet                            3.0.4
cryptography                       3.0
idna                               2.10
Jinja2                             2.11.2
lxml                               4.5.2
MarkupSafe                         1.1.1
nsx-policy-python-sdk              2.5.1.0.5.16221899
nsx-python-sdk                     2.5.1.0.5.16221899
nsx-vmc-aws-integration-python-sdk 2.5.1.0.5.16221899
nsx-vmc-policy-python-sdk          2.5.1.0.5.16221899
pip                                20.2.2
pycparser                          2.20
pyOpenSSL                          19.1.0
pyvmomi                            7.0
PyYAML                             5.3.1
requests                           2.24.0
setuptools                         49.6.0
six                                1.15.0
suds-jurko                         0.6
urllib3                            1.25.10
vapi-client-bindings               3.3.0
vapi-common-client                 2.15.0
vapi-runtime                       2.15.0
vmc-client-bindings                1.26.0
vmc-draas-client-bindings          1.10.0
vSphere-Automation-SDK             1.32.0

 

This assumes you have vmware_vm_inventory as one of the enabled_plugins in ansible.cfg, something like this.

[inventory]
enable_plugins = host_list, ini, yaml, vmware_vm_inventory

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 9e38a1 in the box below so that we can be sure you are a human.