TypeError: call_api() got an unexpected keyword argument 'async'

1/21/2019

I ran Kubespray on a couple of nodes and now I'm trying to run my own Ansible Playbook to deploy my Kubernetes Cluster. When I'm running the k8s playbook command to create a namespace (or any other k8s object creation command), I receive the following error message:

Traceback (most recent call last):
  File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 113, in <module>
    _ansiballz_main()
  File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 105, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/Patrick/.ansible/tmp/ansible-tmp-1547837481.1-223460946163844/AnsiballZ_k8s.py", line 48, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_k8s_payload_tSXyYV/__main__.py", line 171, in <module>
  File "/tmp/ansible_k8s_payload_tSXyYV/__main__.py", line 167, in main
  File "/tmp/ansible_k8s_payload_tSXyYV/ansible_k8s_payload.zip/ansible/module_utils/k8s/raw.py", line 89, in execute_module
  File "/tmp/ansible_k8s_payload_tSXyYV/ansible_k8s_payload.zip/ansible/module_utils/k8s/common.py", line 174, in get_api_client
  File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 58, in __init__
    self._load_server_info()
  File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 62, in _load_server_info
    self.__version = {'kubernetes': load_json(self.request('get', '/version'))}
  File "/usr/local/lib/python2.7/dist-packages/openshift/dynamic/client.py", line 253, in request
    _return_http_data_only=params.get('_return_http_data_only', True)
TypeError: call_api() got an unexpected keyword argument 'async'

That's the playbook I'm trying to execute:

---
- hosts: webapp
  name: Deploy the whole webapp
  tasks:
    - name: Install Openshift Pip module
      pip:
        name: openshift
    - name: Create a k8s namespace
      k8s:
        name: webapp
        api_version: v1
        kind: Namespace
        state: present

And the command I'm using to start the playbook is ansible-playbook -i hosts.ini --become --become-user=root webapp.yml

I'm running out of ideas how to debug that issue and hope somebody know how to solve that.

Regards
Patrick

-- patreu22
ansible
kubernetes
python
typeerror

0 Answers