"CollectionModuleUtilLocator can only locate below ansible_collections"

Hi everyone!
I’m developing a new collection to backup the configuration files from hp switches.
I developed the collection following this guide: Creating collections — Ansible Documentation .
The modules i’ve wrote are ok and they work fine (i tested them as single module), but when i try them through the collection i receive this error:

I don’t understand! My collection is under ansible_collection!
It seems like it does not see the ‘hpswitch’ directory.
path: /home/rubber/.ansible/collections/ansible_collections/hpnetworks/hpswitch)
I try to the create the same collection but in another directory (/home/rubber/Desktop/prova//collections/ansible_collections/hpnetworks/hpswitch) but it does not work.
Playbook from which i test the collection:

- hosts: x

  collections:
    - hpnetworks.hpswitch
  tasks:
    - name: backup running-config 
      hpswitch_config:
        backup: True

Can anyone help me please?

Your import path is missing the collection’s name (hwswitch).

You’re right!! In my module i was importing another module from module_utils, without ‘hpswitch’ in the path.
I feel so dumb. Thank you very much! Have a nice day :smiling_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.