# fetching VMs Info via Anisble

**URL:** <https://forum.ansible.com/t/fetching-vms-info-via-anisble/36981>\
**Category:** Ansible Project\
**Tags:** vmware, ansible-project\
**Created:** [August 12, 2022, 2:39am UTC](https://forum.ansible.com/t/fetching-vms-info-via-anisble/36981 "2022-08-12T02:39:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karun\_pruthi](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@karun\_pruthi](https://forum.ansible.com/u/karun_pruthi)\
**Post date:** [August 12, 2022, 2:39am UTC](https://forum.ansible.com/t/fetching-vms-info-via-anisble/36981/1 "2022-08-12T02:39:00Z")

</div>

Hi Team

I am trying to fetch different VMs info using vminfo module nd my Yaml looks like below:

===============playbook yaml=============

- hosts: Web  
gather\_facts: false  
become: false  
vars:  
vcenter\_hostname: x.x.x.x  
vcenter\_username:   
vcenter\_password:   
tasks:

- name: Gather all registered virtual machines  
community.vmware.vmware\_vm\_info:  
hostname: ‘{{ vcenter\_hostname }}’  
username: ‘{{ vcenter\_username }}’  
password: ‘{{ vcenter\_password }}’  
delegate\_to: localhost  
register: vminfo

- debug:  
msg: “{{ item.guest\_name }}, {{ item.ip\_address }}”  
with\_items:

- “{{ vminfo.virtual\_machines }}”

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [August 12, 2022, 3:48am UTC](https://forum.ansible.com/t/fetching-vms-info-via-anisble/36981/2 "2022-08-12T03:48:53Z")

</div>

> Hi Team
> 
> I am trying to fetch different VMs info using vminfo module nd my Yaml looks like below:
> 
> ===============playbook yaml=============
> 
> - hosts: Web  
> gather\_facts: false  
> become: false  
> vars:  
> vcenter\_hostname: x.x.x.x  
> vcenter\_username:   
> vcenter\_password:   
> tasks:
> 
> - name: Gather all registered virtual machines  
> community.vmware.vmware\_vm\_info:  
> hostname: ‘{{ vcenter\_hostname }}’  
> username: ‘{{ vcenter\_username }}’  
> password: ‘{{ vcenter\_password }}’  
> delegate\_to: localhost  
> register: vminfo
> 
> - debug:  
> msg: “{{ item.guest\_name }}, {{ item.ip\_address }}”  
> with\_items:
> 
> - “{{ vminfo.virtual\_machines }}”
> 
> =========================================
> 
> In the hosts file i have give Vcenter IP details as below:
> 
> ========Host file==========  
> [Web]  
> x.x.x.x #ip of my vcenter server
> 
> ==============
> 
> But while triggering ansible playbook i am getting error as below:
> 
> ================Error==================
> 
> **[WARNING]: Could not match supplied host pattern, ignoring: vmware\_test.yaml**

This is your error.  
It indicates that you ‘triggered’ ansible playbook incorrectly. Apparently you supplied a file name as the host pattern.  
What are you files called?  
And what command do you run?

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [August 12, 2022, 6:03pm UTC](https://forum.ansible.com/t/fetching-vms-info-via-anisble/36981/3 "2022-08-12T18:03:32Z")

</div>

I recommend you take an ansible class. The class is very worth the time and money. It will help you past these initial hurdles more quickly than asking in online forums. I put over 50 people through it two years ago. Worth every penny.
