Open kgfcoder6 opened 1 year ago
@kgfcoder6 which version of the collection are you using? Also, you are using a very old version of ansible. The current version is 2.15.
yes i am using old version of ansible, its 2.9.27 ansible --version /usr/local/lib/python3.6/dist-packages/ansible/parsing/vault/init.py:44: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6. from cryptography.exceptions import InvalidSignature ansible 2.9.27 config file = /opt/ansible/ansible.cfg configured module search path = ['/opt/ansible/ansible_plugins/modules'] ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible executable location = /usr/local/bin/ansible python version = 3.6.9 (default, Mar 10 2023, 16:46:00) [GCC 8.4.0]
As i told i have a project requirement to build the rke cluster on this old version
I still need to know the version of the collection you are using to debug this. Since you are using an old version of ansible, you will have to look in the MANIFEST.json file where the collection is installed to get the version.
cat MANIFEST.json { "collection_info": { "namespace": "community", "name": "kubernetes", "version": "2.0.1", "authors": [ "chouseknecht (https://github.com/chouseknecht)", "geerlingguy (https://www.jeffgeerling.com/)", "maxamillion (https://github.com/maxamillion)", "jmontleon (https://github.com/jmontleon)", "fabianvf (https://github.com/fabianvf)", "willthames (https://github.com/willthames)", "mmazur (https://github.com/mmazur)", "jamescassell (https://github.com/jamescassell)" ], "readme": "README.md", "tags": [ "kubernetes", "k8s", "cloud", "infrastructure", "openshift", "okd", "cluster" ], "description": "Kubernetes Collection for Ansible.", "license": [], "license_file": "LICENSE", "dependencies": { "kubernetes.core": ">=2.0.0" }, "repository": "https://github.com/ansible-collections/community.kubernetes", "documentation": "", "homepage": "", "issues": "https://github.com/ansible-collections/community.kubernetes/issues" }, "file_manifest_file": { "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", "chksum_sha256": "0158009feef57d08f38ee8646123e61f6085d5838421fc5583249235f03731c8", "format": 1 }, "format": 1
Its "version": "2.0.1"
ALso I am unable to update the k8 plugin and getting below error
ansible-galaxy collection install kubernetes.core -vvv ansible-galaxy [core 2.12.0] config file = None configured module search path = ['/home/prathap/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible ansible collection location = /home/prathap/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible-galaxy python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] jinja version = 3.0.3 libyaml = True No config file found; using defaults Starting galaxy collection install process Process install dependency map ERROR! Unexpected Exception, this is probably a bug: CollectionDependencyProvider.find_matches() got an unexpected keyword argument 'identifier' the full traceback was:
Traceback (most recent call last):
File "/usr/bin/ansible-galaxy", line 128, in
BUt this might be due to version issue and as I told I would not be able to update python and ansible versions, will try with higher rke versions but could you please suggest what changes has to be done to configure k8 plugins for this ansible ?
It looks like you are using ansible 2.12 here, which is no longer supported. I would strongly suggest using at least ansible 2.13, though preferably higher.
sorry previously i was looking in community folder, I again checked kubernetes folder inside collections,
external_collections/ansible_collections/kubernetes/core$ cat MANIFEST.json { "collection_info": { "namespace": "kubernetes", "name": "core", "version": "2.4.0", "authors": [ "chouseknecht (https://github.com/chouseknecht)", "geerlingguy (https://www.jeffgeerling.com/)", "maxamillion (https://github.com/maxamillion)", "jmontleon (https://github.com/jmontleon)", "fabianvf (https://github.com/fabianvf)", "willthames (https://github.com/willthames)", "mmazur (https://github.com/mmazur)", "jamescassell (https://github.com/jamescassell)" ], "readme": "README.md", "tags": [ "kubernetes", "k8s", "cloud", "infrastructure", "openshift", "okd", "cluster" ], "description": "Kubernetes Collection for Ansible.", "license": [], "license_file": "LICENSE", "dependencies": {}, "repository": "https://github.com/ansible-collections/kubernetes.core", "documentation": "", "homepage": "", "issues": "https://github.com/ansible-collections/kubernetes.core/issues" }, "file_manifest_file": { "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", "chksum_sha256": "67908745863fefe0495eee77399178e88b89bb04a19fc728d2ac83a4d93abd1a", "format": 1 }, "format": 1
and version is 2.4.0
I cannot reproduce this. Using the playbook you provided, python 3.6, ansible 2.9.27 and kubernetes.core 2.4.0 it works.
but still i guess playbooks are taking old version and as you could see when i tried to update it said core 2.12 so i am really confused that even though inside kubernetes folder core says 2.4, it may be using 2.12 core and unable to update as it gives above error
@kgfcoder6 just hitting your same bug in my playbook using kubernetes.core collection at version 2.4.0 for a 1.28.2 Kubernetes cluster
I workarounded the error by removing the 2.4.0 version of the collection and installing the 2.3.2
@gravesm if some other data are needed just ask :)
Ansible Version:
[root@bastion ansible]# ansible --version
ansible 2.9.27
config file = /opt/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, May 31 2023, 10:28:59) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]
Ansible configuration:
[root@bastion ansible]# cat ansible.cfg
[defaults]
inventory = ./inventory
roles_path = ./roles
#interpreter_python = /usr/bin/python3
ansible_python_interpreter = /usr/bin/python3
private_key_file = /root/.ssh/ansible_rsa
host_key_checking = False
deprecation_warnings = False
display_skipped_hosts = False
# become = True
# become_method = sudo
# become_user = root
[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
The task that cause the error:
- name: Create secret
kubernetes.core.k8s:
state: present
kind: Secret
definition:
apiVersion: v1
kind: Secret
metadata:
name: vault-token-auth
namespace: default
annotations:
kubernetes.io/service-account.name: default
type: kubernetes.io/service-account-token
EDIT: Tomorrow I will try also to redeploy the kubernetes cluster with fresh vm and test the playbook with the 2.4.0 collections
SUMMARY
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: ansible_collections.kubernetes.core.plugins.module_utils.client.discovery.spec is None fatal: [rancher01.test1.nbg]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
The full traceback is: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/ansible/executor/task_executor.py", line 147, in run res = self._execute() File "/usr/local/lib/python3.6/dist-packages/ansible/executor/task_executor.py", line 665, in _execute result = self._handler.run(task_vars=variables) File "/opt/ansible/roles/external_collections/ansible_collections/kubernetes/core/plugins/action/k8s.py", line 398, in run task_vars=task_vars, File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/action/init.py", line 825, in _execute_module (module_style, shebang, module_data, module_path) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars) File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/action/init.py", line 211, in _configure_module *become_kwargs) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 1283, in modify_module environment=environment) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 1120, in _find_module_utils py_module_cache, zf) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 911, in recursive_finder py_module_names, py_module_cache, zf) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 911, in recursive_finder py_module_names, py_module_cache, zf) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 911, in recursive_finder py_module_names, py_module_cache, zf) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 751, in recursive_finder [os.path.join(py_module_name[:-idx])]) File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 671, in init self.get_source() File "/usr/local/lib/python3.6/dist-packages/ansible/executor/module_common.py", line 687, in get_source data = pkgutil.get_data(to_native(self._package_name), to_native(self._mod_name + '.py')) File "/usr/lib/python3.6/pkgutil.py", line 616, in get_data spec = importlib.util.find_spec(package) File "/usr/lib/python3.6/importlib/util.py", line 102, in find_spec raise ValueError('{}.spec is None'.format(name)) ValueError: ansible_collections.kubernetes.core.plugins.module_utils.client.discovery.spec is None fatal: [rancher01.test1.nbg]: FAILED! => { "msg": "Unexpected failure during module execution.", "stdout": "" }
ISSUE TYPE
COMPONENT NAME
kubernetes.core.k8s
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
OS - Ubuntu 20 python 3.6 Ansible 2.9 rke_rancher_version: '2.6.3' rke_version: 'v1.3.3' rke_kubernetes_version: 'v1.21.7-rancher1-1'
STEPS TO REPRODUCE
If we run any simple playbook to create kubernetes namespace using the kubernetes.core.k8s collection, the error would reoccur and doesnot allow to use module to create namespace and gives error with ansible_collections/kubernetes/core/plugins/module_utils/client/disocovery.py and i didnot find any existing issue here and as i am trying to create a rke cluster in test environment replicating existing prod setup, need this to run on older versions as mentioned above, please help to fix dynamic discovery plugin as it continuously tells spec not found and not sure what to change.
EXPECTED RESULTS
namespace should be created and dynamic module should be configured by the ansible collections
ACTUAL RESULTS