Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KubeVirt module error "Could not find imported module support code" #40

Open
B3DTech opened this issue Feb 25, 2022 · 2 comments
Open

Comments

@B3DTech
Copy link

B3DTech commented Feb 25, 2022

Summary

What happened:
Installed Ansible on Mac for the user using pip method.

Built a KubeVirt playbook and ran it with ansible-playbook deployvm.yaml and get the following error:

fatal: [localhost]: FAILED! => {"msg": "Could not find imported module support code for ansible_collections.community.kubevirt.plugins.modules.kubevirt_vm. Looked for (['ansible_collections.community.kubernetes.plugins.module_utils.common.AUTH_ARG_SPEC', 'ansible_collections.community.kubernetes.plugins.module_utils.common'])"}

What you expected to happen:

Dependencies are find

How to reproduce it (as minimally and precisely as possible):
OS X 12.3

pip
python -m pip install --user ansible
ansible-playbook server2022.yaml

The playbook looks like:

Environment:

KubeVirt version (use virtctl version): 0.50.0
Kubernetes version (use kubectl version): 1.23.2
VM or VMI specifications:
Cloud provider or hardware configuration: Rancher K8S cluster
OS (e.g. from /etc/os-release): OS x
Kernel (e.g. uname -a): Darwin MaxBookPro.local 21.4.0 Darwin Kernel Version 21.4.0: Tue Jan 18 13:02:01 PST 2022; root:xnu-8020.100.406.0.1~18/RELEASE_X86_64 x86_64

Issue Type

Bug Report

Component Name

kubevirt

Ansible Version

$ ansible --version
ansible [core 2.12.2]
  config file = None
  configured module search path = ['/Users/mdiorio/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mdiorio/Library/Python/3.9/lib/python/site-packages/ansible
  ansible collection location = /Users/mdiorio/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/mdiorio/Library/Python/3.9/bin/ansible
  python version = 3.9.10 (main, Jan 15 2022, 11:48:04) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True

Configuration

$ ansible-config dump --only-changed

Empty

OS / Environment

Running on Mac OS X 12.3 targeting a Kubernetes Cluster

Steps to Reproduce


name: Create Windows 2022 VM
hosts: localhost
connection: local
tasks:
name: Create Windows 2022 VirtVM
kubevirt_vm:
namespace: default
name: win2022
state: running
cpu_cores: 2
memory: 4Gi
disks:

  • name: containerdisk
    volume:
    containerDisk:
    image: mcr.microsoft.com/windows/server:ltsc2022
    disk:
    bus: virtio

Expected Results

Even if my playbook may not work - I don't expect an error about not finding related components.

Actual Results

ansible-playbook [core 2.12.2]
  config file = None
  configured module search path = ['/Users/mdiorio/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mdiorio/Library/Python/3.9/lib/python/site-packages/ansible
  ansible collection location = /Users/mdiorio/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/mdiorio/Library/Python/3.9/bin/ansible-playbook
  python version = 3.9.10 (main, Jan 15 2022, 11:48:04) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
yaml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
ini declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Skipping due to inventory source not existing or not being readable by the current user
toml declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
[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'
redirecting (type: modules) ansible.builtin.kubevirt_vm to community.kubevirt.kubevirt_vm
Loading collection community.kubevirt from /Users/mdiorio/.ansible/collections/ansible_collections/community/kubevirt
Loading callback plugin default of type stdout, v2.0 from /Users/mdiorio/Library/Python/3.9/lib/python/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: server2022.yaml **************************************************************************************************************************************
Positional arguments: server2022.yaml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/etc/ansible/hosts',)
forks: 5
1 plays in server2022.yaml

PLAY [Create Windows 2022 VM] **********************************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************************************
task path: /Users/mdiorio/ansible/kubevirt/server2022.yaml:2
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: mdiorio
<127.0.0.1> EXEC /bin/sh -c 'echo ~mdiorio && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/mdiorio/.ansible/tmp `"&& mkdir "` echo /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876 `" && echo ansible-tmp-1645560845.436065-75963-18147611961876="` echo /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876 `" ) && sleep 0'
Using module file /Users/mdiorio/Library/Python/3.9/lib/python/site-packages/ansible/modules/setup.py
<127.0.0.1> PUT /Users/mdiorio/.ansible/tmp/ansible-local-75959rq5rv3uu/tmppswjjh_a TO /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876/ /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/local/opt/[email protected]/bin/python3.9 /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560845.436065-75963-18147611961876/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
META: ran handlers

TASK [Create Windows 2022 VirtVM] ******************************************************************************************************************************
task path: /Users/mdiorio/ansible/kubevirt/server2022.yaml:6
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: mdiorio
<127.0.0.1> EXEC /bin/sh -c 'echo ~mdiorio && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/mdiorio/.ansible/tmp `"&& mkdir "` echo /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560851.607106-76001-148064369010803 `" && echo ansible-tmp-1645560851.607106-76001-148064369010803="` echo /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560851.607106-76001-148064369010803 `" ) && sleep 0'
redirecting (type: modules) ansible.builtin.kubevirt_vm to community.kubevirt.kubevirt_vm
Loading collection community.kubernetes from /Users/mdiorio/.ansible/collections/ansible_collections/community/kubernetes
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/mdiorio/.ansible/tmp/ansible-tmp-1645560851.607106-76001-148064369010803/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "msg": "Could not find imported module support code for ansible_collections.community.kubevirt.plugins.modules.kubevirt_vm.  Looked for (['ansible_collections.community.kubernetes.plugins.module_utils.common.AUTH_ARG_SPEC', 'ansible_collections.community.kubernetes.plugins.module_utils.common'])"
}

PLAY RECAP *****************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
@HSBawa
Copy link

HSBawa commented Mar 11, 2022

try installing 1.2.1 version of community.kubernetes.

@Andersson007
Copy link
Contributor

the collection is currently unmaintained and was removed from the Ansible package
FYI if someone wants to pick it up, welcome! we'd be happy to help with any general questions on how to maintain it, just ask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants