Make sure the community.vmware collection is installed if you’re using 2.10 or later. You can use the --playbook-dir option with ansible-inventory if the collection is playbook-adjacent rather than in a configured path.
And with -vvv : /usr/lib/python2.7/dist-packages/ansible/parsing/vault/init.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release. from cryptography.exceptions import InvalidSignature ansible-inventory 2.5.1 config file = /etc/ansible/ansible.cfg configured module search path = [u’/home/admincpc/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible-inventory python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0] Using /etc/ansible/ansible.cfg as config file [WARNING]: Failed to load inventory plugin, skipping vmware_vm_inventory
ERROR! No inventory plugins available to generate inventory, make sure you have at least one whitelisted.
Hi Abhijeet,
Thank you very much for your help and your speed !
I install the version Ansible 2.12 and there is no error message
But my inventory does not return anything, Do you have an idea ?
Sorry I’m a beginner on Ansible
Thanks for your help
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12.
Current version: 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]. This feature will be removed from ansible-
core in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/init.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
ansible-inventory [core 2.11.1]
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/home/admincpc/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
ansible collection location = /home/admincpc/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-inventory
python version = 2.7.17 (default, Feb 27 2021, 15:10:58) [GCC 7.5.0]
jinja version = 2.10
libyaml = True
Using /etc/ansible/ansible.cfg as config file
redirecting (type: inventory) ansible.builtin.vmware_vm_inventory to community.vmware.vmware_vm_inventory
Skipping due to inventory source not existing or not being readable by the current user
ansible_collections.community.vmware.plugins.inventory.vmware_vm_inventory declined parsing /home/admincpc/inventory.vmware.yml as it did not pass its verify_file() method
[WARNING]: Unable to parse /home/admincpc/inventory.vmware.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
“_meta”: {
“hostvars”: {}
},
“all”: {
“children”: [
“ungrouped”
]
}
}
Skipping due to inventory source not existing or not being readable by the current user
ansible_collections.community.vmware.plugins.inventory.vmware_vm_inventory declined parsing /home/admincpc/inventory.vmware.yml as it did not pass its verify_file() method
Check if /home/admincpc/inventory.vmware.yml is accessible and readable by the current user (the user which is running the ansible-inventory command).
Hello Abhijeet Kasurde,
Sorry for the delay, I succeeded in changing the rights.
I now have an inventory with hundreds of lines and info,
is it possible to have a simple inventory sorted by TAG ? ( on my vcenter my machines are tagged by PROD or TEST)
Thank you very much for your help!
Sincerely,
Soufiane
You are so nice, thank you very much !!
My current inventory configuration file is :
strict: False
hostname: 10.0.250.100
username: myemail
password: Mypassword
validate_certs: False
with_tags: True
In my vcenter, I have machines that are tagged with PROD, TEST or OTHER.
I would like to have an inventory that differentiates TEST tags from PROD tags or OTHER tags
for exemple i want this :
PROD:
machine1
machine2
…
TEST:
machine4
machine9
…
Do you understand my need?
Thank you again, you are at the top!
Sorry for the delay,
The problem with your solution is that I have too much information and I would like to have only the machines of a TAG.
I tried this:
My goal would be to have several inventories for example :
inventory_prod.yml with in it the machines that are TAG “PROD”
an inventory_test.yml with the machines that are TAG “TEST”
Because currently in one file there are really all the machines and way too much information that is useless to me.