Unable to get the VM list from Ansible tower

Hello I am getting an error while collecting VM the data using ansible
<—

  • name: Role ensures that the socks tunnel is setup
    hosts: localhost
    connection: local
    gather_facts: no
    tasks:
    • include_role:
      name: ansible-role-event-socks-tunnel
      vars:
      transaction_id: “{{ tower_job_id }}”
  • name: Collect Windows Servers Configuration
    hosts: all
    tasks:

- name: Gather VM information

community.vmware.vmware_vm_info:

  • name: Get info about tag
    community.vmware.vmware_tag_info:
    hostname: “{{ xxxxxx}}”
    username: “{{ xxxxx }}”
    password: “{{ xxxxx }}”
    validate_certs: no
    register: vm_info_result
- name: Print VM information
  debug:
    var: vm_info_result

- name: Extract VM names and tag details
  set_fact:
    vm_names: "{{ vm_info_result.virtual_machines | map(attribute='name') | list }}"
    vm_tags: "{{ vm_info_result.virtual_machines | map(attribute='tags') | list }}"

/>

ERROR! couldn’t resolve module/action ‘community.vmware.vmware_tag_info’. This often indicates a misspelling, missing collection, or incorrect module path.

14

15

The error appears to be in ‘/runner/project/collect_vm_information_based_on_tag.yml’: line 15, column 7, but may

16

be elsewhere in the file depending on the exact syntax problem.

17

18

The offending line appears to be:

19

20

tasks:

21

  • name: Get info about tag

22

^ here

Please edit you post and put you config files in code block </> just like this:

This is line one
This is line two
  this is idented. 

Then we can see clearly what you have.

Thank you i did it and attached as a image also it could help to find the gap

Still looks bad, please fix the code block. No need for an image please.

Don’t paste an image. I’ve said this already - please read my posts rather than rushing to answer.

Please paste your content in code blocks as text. You paste your text, highlight it and then use the </> icon on the menu bar of the editing window where you pasted your text.

---
- name: Role ensures that the socks tunnel is setup
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
    - include_role:
        name: ansible-role-event-socks-tunnel
      vars:
        acc_id: axd
        transaction_id: "{{ tower_job_id }}"
- name: Collect Windows Servers Configuration
  hosts: all
  tasks:
    - name: Get info about tag
      community.vmware.vmware_tag_info:
        hostname: "{{ xxxxx }}"
        username: "{{ xxxxx }}"
        password: "{{ xxxxx}}"
        validate_certs: no
      register: vm_info_result
    - name: Print VM information
      debug:
        var: vm_info_result
    - name: Extract VM names and tag details
      set_fact:
        vm_names: "{{ vm_info_result.virtual_machines | map(attribute='name') | list }}"
        vm_tags: "{{ vm_info_result.virtual_machines | map(attribute='tags') | list }}"

Job Log data

ansible-playbook [core 2.13.8]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.9.16 (main, May 31 2023, 12:21:58) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]
  jinja version = 3.0.3
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
SSH password: 
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with script plugin
ERROR! couldn't resolve module/action 'community.vmware.vmware_tag_info'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/runner/project/collect_vm_information_based_on_tag.yml': line 15, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Get info about tag
      ^ here

Did you install the vmware module from ansible galaxy?