Create a playbook for VMWare guest snapshot

Latest response

Hi, can I ask some help on the playbook?
I want to create a playbook that create snapshot in VMWare but having a problem with an error "ERROR! couldn't resolve module/action 'community.vmware.vmware_guest_snapshot'. This often indicates a misspelling, missing collection, or incorrect module path."

I already installed in the ansible server (automationcontroller) the community.vmware collection and already showing in "ansible-galaxy collection list", also installed pyvmomi using "pip3.8 install pyvmomi" and other requirements using "pip3.8 install -r ~/.ansible/collections/ansible_collections/community/vmware/requirements.txt" as awx user.

Still same error :(

OS: RHEL 8
RH Ansible Automation Platform 2.1
AutomationHub- not installed
VMware vSphere Client version 6.7.0.50000

ansible-playbook --version

ansible-playbook [core 2.12.1]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.8.8 (default, Aug 11 2021, 06:52:42) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True

YAML script:

---
- hosts: all
  gather_facts: false

  tasks:
  - name: "INCLUDES | Include vars"
    include_vars: group_vars/vcenter.yml
    no_log: true

  - name: Create a snapshot
    community.vmware.vmware_guest_snapshot:
      hostname: "{{ vcenter_host }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      datacenter: "My Datacenter"
      folder: "/My Datacenter/"
      name: "MYSERVER1"
      state: present
      snapshot_name: ansible_snapshot
      description: ansible_snapshot
    delegate_to: localhost

Responses

Solution: Have to add a requirements.yml under collections directory in my Repository when running it from the Tower GUI.

# collections/requirements.yml

collections: - community.vmware

I'd like to create a snapshot when variable from previous playbook has changed == true, any ideas?