ansible-collections / vmware.vmware_rest

Ansible Collection for VMWare (REST modules)
https://ansible-collections.github.io/vmware.vmware_rest/
GNU General Public License v3.0
131 stars 64 forks source link

Collection vmware.vmware_rest does not support Ansible version 2.13.13 #490

Closed yobshans closed 6 months ago

yobshans commented 6 months ago
SUMMARY

I got error while run simple playbook "Collection vmware.vmware_rest does not support Ansible version 2.13.13" Yes, I see compatibility warning: This collection has been tested against following Ansible versions: >=2.14.0. How to use the collection with lower version of ansible ?

ISSUE TYPE
ANSIBLE VERSION
# ansible --version
ansible [core 2.13.13]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.16 (default, Dec 21 2022, 10:58:32) [GCC 8.5.0 20210514 (Red Hat 8.5.0-17)]
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# ansible-galaxy collection list vmware.vmware_rest

# /root/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
vmware.vmware_rest 3.0.1  

# /usr/local/lib/python3.8/site-packages/ansible_collections
Collection         Version
------------------ -------
vmware.vmware_rest 2.2.0  
CONFIGURATION
OS / ENVIRONMENT
Red Hat Enterprise Linux release 8.8 (Ootpa)
STEPS TO REPRODUCE
Install 
pip install aiohttp
ansible-galaxy collection install vmware.vmware_rest

Run playbook
- hosts: localhost
  vars:
    vmware_host: "*****"
    vmware_user: "*****"
    vmware_password: "*****"
  tasks:
    - name: Example task using vmware_rest module
      vmware.vmware_rest.vmware_rest:
        hostname: "{{ vmware_host }}"
        username: "{{ vmware_user }}"
        password: "{{ vmware_password }}"
        validate_certs: False
        path: "/rest/vcenter/vm"
        method: "get"
      register: result

    - debug:
        var: result
EXPECTED RESULTS

Should work with Ansible version 2.13.13

ACTUAL RESULTS
# ansible-playbook -vv test.yaml 
ansible-playbook [core 2.13.13]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.16 (default, Dec 21 2022, 10:58:32) [GCC 8.5.0 20210514 (Red Hat 8.5.0-17)]
  jinja version = 3.1.3
  libyaml = True
No config file found; using defaults
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Collection vmware.vmware_rest does not support Ansible version 2.13.13
ERROR! couldn't resolve module/action 'vmware.vmware_rest.vmware_rest'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/vmware/test.yaml': line 7, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Example task using vmware_rest module
      ^ here
machacekondra commented 6 months ago

It's required since: https://github.com/ansible-collections/vmware.vmware_rest/pull/439 @GomathiselviS Do you know why?

gravesm commented 6 months ago

Ansible 2.13 is no longer supported. You can find the support matrix here: https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix.

yobshans commented 6 months ago

Thank you for response. Python 3.8 is still supported https://devguide.python.org/versions/ Latest version of ansible which I can install 2.13.13

yobshans commented 6 months ago

Just updated python and ansible and my test playbook failed on

ansible-playbook -vv test.yaml

ansible-playbook [core 2.15.10] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.9/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.9.16 (main, Dec 21 2022, 10:57:18) [GCC 8.5.0 20210514 (Red Hat 8.5.0-17)] (/usr/bin/python3.9) jinja version = 3.1.3 libyaml = True No config file found; using defaults [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! couldn't resolve module/action 'vmware.vmware_rest.vmware_rest'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/vmware/test.yaml': line 7, column 7, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

tasks:

Here is part of playbook tasks:

mariolenz commented 6 months ago

ERROR! couldn't resolve module/action 'vmware.vmware_rest.vmware_rest'. This often indicates a misspelling, missing collection, or incorrect module path.

There's no vmware_rest module in the vmware.vmware_rest collection...

yobshans commented 6 months ago

Sorry, I don't understand your response. I have installed vmware.vmware_rest What's wrong ?

# ansible-galaxy collection list vmware.vmware_rest

# /root/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
vmware.vmware_rest 3.0.1  

# /usr/local/lib/python3.9/site-packages/ansible_collections
Collection         Version
------------------ -------
vmware.vmware_rest 2.3.1  

BTW, why we have 2 different versions ?

# ansible-galaxy collection install vmware.vmware_rest --force
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/vmware-vmware_rest-3.0.1.tar.gz to /root/.ansible/tmp/ansible-local-685359aqsinrpy/tmp396a94j3/vmware-vmware_rest-3.0.1-xtm1lj1a
Installing 'vmware.vmware_rest:3.0.1' to '/root/.ansible/collections/ansible_collections/vmware/vmware_rest'
vmware.vmware_rest:3.0.1 was installed successfully
'cloud.common:3.0.0' is already installed, skipping.
mariolenz commented 6 months ago

Sorry, I don't understand your response. I have installed vmware.vmware_rest What's wrong ?

I can explain it to you, but I can't understand it for you...

It would help if you show us your playbook (or at least the task) which is failing.

yobshans commented 6 months ago
# cat test.yaml 
- hosts: localhost
  vars:
    vmware_host: "*****"
    vmware_user: "*****"
    vmware_password: "******"
  tasks:
    - name: Example task using vmware_rest module
      vmware.vmware_rest.vmware_rest:
        hostname: "{{ vmware_host }}"
        username: "{{ vmware_user }}"
        password: "{{ vmware_password }}"
        validate_certs: False
        path: "/rest/vcenter/vm"
        method: "get"
      register: result

    - debug:
        var: result
mariolenz commented 6 months ago

As I've already said, there's no vmware_rest module in the vmware.vmware_rest collection...