-
Notifications
You must be signed in to change notification settings - Fork 85
Could not find imported module support code #181
Comments
@beniyp, these modules are not published at the galaxy server, may be that is why you are getting errors while installing them, could you please try installing from git repo once? |
Hi @mukultaneja Yep, it was downloaded and installed successfully via requirements.yml file using the git repository. However, ansible and awx's custom EE with the collections and dependencies installed, cannot find the imported module support code when I use the module in the playbook referencing the module as namespace.collection.module ex.
|
@beniyp, does your issue still persist? |
Hi @mukultaneja The issue persists; however, I find the root cause and worked around it. The problem is that the modules are not using the collection naming convention. For example, vcd_vapp_vm_snapshot.py with line "from ansible.module_utils.vcd import VcdAnsibleModule" should be replaced with "ansible_collections.vmware.vcloud_director.plugins.module_utils.vcd import VcdAnsibleModule" Then I updated FILES.json, repackaged the collection and was able to install it into the Ansible Execution Environment. I hope this helps. |
Any idea how can we fix it in the repository (without local patching)? |
Hi,
I ran into issues with installing and running this as a collection, but the modules work fine if I copy the modules and module_utils into my local ansible/plugin directories:
bash-4.4# ansible-galaxy collection install vmware.vcloud_director
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible
engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point.
Starting galaxy collection install process
Process install dependency map
ERROR! Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
bash-4.4# ansible-galaxy collection install -r requirements.yml
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible
engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point.
Starting galaxy collection install process
Process install dependency map
Cloning into '/home/runner/.ansible/tmp/ansible-local-10707uryrtdy/tmp5gkfl8di/ansible-module-vcloud-director_d16tk1n'...
remote: Enumerating objects: 1864, done.
remote: Counting objects: 100% (285/285), done.
remote: Compressing objects: 100% (169/169), done.
remote: Total 1864 (delta 164), reused 192 (delta 86), pack-reused 1579
Receiving objects: 100% (1864/1864), 482.00 KiB | 2.31 MiB/s, done.
Resolving deltas: 100% (1085/1085), done.
Branch 'collection' set up to track remote branch 'collection' from 'origin'.
Switched to a new branch 'collection'
Starting collection install process
Installing 'vmware.vcloud_director:0.0.1' to '/home/runner/.ansible/collections/ansible_collections/vmware/vcloud_director'
Created collection for vmware.vcloud_director:0.0.1 at /home/runner/.ansible/collections/ansible_collections/vmware/vcloud_director
vmware.vcloud_director:0.0.1 was installed successfully
bash-4.4# cat requirements.yml
collections:
type: git
version: collection
bash-4.4# ansible-galaxy collection list
[WARNING]: You are running the development version of Ansible. You should only run Ansible from "devel" if you are modifying the Ansible
engine, or trying out features under development. This is a rapidly changing source of code and can become unstable at any point.
/home/runner/.ansible/collections/ansible_collections
Collection Version
vmware.vcloud_director 0.0.1
/usr/share/ansible/collections/ansible_collections
Collection Version
amazon.aws 1.5.0
ansible.posix 1.2.0
ansible.windows 1.6.0
awx.awx 19.2.0
azure.azcollection 1.6.0
community.vmware 1.10.0
google.cloud 1.0.2
kubernetes.core 1.2.1
openstack.cloud 1.4.0
ovirt.ovirt 1.4.2
theforeman.foreman 2.1.0
Ran a simple playbook to list snapshot, and it erred out, but completes successfully if I copy the modules into /home/runner/.ansible/plugins/
Playbook sample:
hosts: localhost
tasks:
vmware.vcloud_director.vcd_vapp_vm_snapshot:
user: ansible_user
...
Error message:
fatal: [localhost]: FAILED! => {"msg": "Could not find imported module support code for ansible_collections.vmware.vcloud_director.plugins.modules.vcd_vapp_vm_snapshot. Looked for (['ansible.module_utils.vcd.VcdAnsibleModule', 'ansible.module_utils.vcd'])"}
bash-4.4# ls -ltr /home/runner/.ansible/collections/ansible_collections/vmware/vcloud_director/plugins/modules/vcd_vapp_vm_snapshot.py
-rw-r--r-- 1 root root 8766 Jun 11 01:17 /home/runner/.ansible/collections/ansible_collections/vmware/vcloud_director/plugins/modules/vcd_vapp_vm_snapshot.py
$ ansible --version
ansible [core 2.12.0.dev0]
config file = None
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.3 (default, Aug 31 2020, 16:03:14) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
jinja version = 2.10.3
libyaml = True
Please advise, thanks!
The text was updated successfully, but these errors were encountered: