ansible / community

This repository is being archived. See https://github.com/ansible-community/presentations and https://github.com/ansible-community/meetings for the new locations
Apache License 2.0
489 stars 144 forks source link

ERROR! couldn't resolve module/action 'community.kubernetes.k8s' #624

Closed amin224 closed 3 years ago

amin224 commented 3 years ago

ISSUE TYPE

COMPONENT NAME

SUMMARY

I am trying to use the community.kubernetes.k8s module for my ansible-playbook but I am unable to run it, I believe ansible is not able to find the module. I've tried many attempts from various sources to solve this issue.

ENVIRONMENT

ansible 2.9.6
  config file = /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]

STEPS TO REPRODUCE

ansible-playbook main.yml --ask-become-pass -vvv

ansible-playbook 2.9.6
  config file = /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.8.5 (default, May 27 2021, 13:30:53) [GCC 9.3.0]
Using /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/ansible.cfg as config file
BECOME password: 
host_list declined parsing /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/inventory.yml as it did not pass its verify_file() method
script declined parsing /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/inventory.yml as it did not pass its verify_file() method
Parsed /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/inventory.yml inventory source with ini plugin
**ERROR! couldn't resolve module/action 'community.kubernetes.k8s'. This often indicates a misspelling, missing collection, or incorrect module path.**

The error appears to be in '/home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/main.yml': line 11, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - name: Ensure the myapp Namespace exists.
      ^ here

EXPECTED RESULTS

Deploy my Kubernetes resources to my cluster

ADDITIONAL INFORMATION

I noticed that it states configured module search path = ['/home/user/.ansible/plugins/modules] but in my directory there is no plugins folder, in addition /usr/share/ansible directory does not exist ansible1 ansible2

I also added in my ansible.cfg file the collections_path in order to resolve this problem but it did not work

[defaults]
inventory = /home/user/Desktop/Kubernetes/ansible-Examples/deploymentUsingPlaybook/inventory.yml
collections_paths = /home/user/.ansible/collections/ansible_collections
Akasurde commented 3 years ago

@amin224 Thanks for reporting this issue. Please open an issue against https://github.com/ansible-collections/kubernetes.core repo.