openshift/openshift-restclient-python

Failed to create object: the server could not find the requested resource with ansible module

Closed this issue · 2 comments

i m getting the indicated error with k8s_v1beta1_role_binding and with this sample playbook

- name: Testing playbook
  hosts: localhost
  gather_facts: false
  connection: local
  roles:
    - role: ansible.kubernetes-modules
      install_python_requirements: no
  tasks:
  - name: Set variables
    set_fact:
      namespace: xxx
  - name: Create Service Account
    k8s_v1_service_account:
      name: magico
      namespace: "{{ namespace }}"
  - name: Create Role Binding
    k8s_v1beta1_role_binding:
      name: edit
      namespace: "{{ namespace }}"
      subjects:
      - kind: ServiceAccount
        name: magico
        namespace: "{{ namespace }}"

the full traceback goes like this:

The full traceback is:
  File "/tmp/ansible_T_cJGZ/ansible_modlib.zip/ansible/module_utils/k8s_common.py", line 251, in _create
    k8s_obj = self.helper.create_object(namespace, body=request_body)
  File "/root/ansible/lib/python2.7/site-packages/openshift/helper/base.py", line 259, in create_object
    raise self.get_exception_class()(msg, status=exc.status)

fatal: [localhost]: FAILED! => {
    "changed": false,
    "error": 404,
    "failed": true,
    "invocation": {
        "module_args": {
            "annotations": null,
            "api_key": null,
            "cert_file": null,
            "context": null,
            "debug": false,
            "force": false,
            "host": null,
            "key_file": null,
            "kubeconfig": null,
            "labels": null,
            "name": "edit",
            "namespace": "postgrekarimbo",
            "password": null,
            "resource_definition": null,
            "role_ref_api_group": null,
            "role_ref_kind": null,
            "role_ref_name": "edit",
            "src": null,
            "ssl_ca_cert": null,
            "state": "present",
            "subjects": [
                {
                    "kind": "ServiceAccount",
                    "name": "magico",
                    "namespace": "postgrekarimbo"
                }
            ],
            "username": null,
            "verify_ssl": null
        }
    },
    "msg": "Failed to create object: the server could not find the requested resource"
}

What version of openshift/kubernetes are you using?

oc v3.7.0-alpha.1+c79599c-1172
kubernetes v1.7.6+a08f5eeb62
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://localhost:8443
openshift v3.7.0-alpha.1+b10446e-1184
kubernetes v1.7.6+a08f5eeb62