0

I use the kubespray v2.11.2 to setup a kubernetes cluster. However, the error occurred with "couldn't resolve module/action 'kube'" :

- name: Kubernetes Apps | Add policies, roles, bindings for PodSecurityPolicy
  kube:
    name: "{{ item.item.name }}"
    kubectl: "{{ bin_dir }}/kubectl"
    resource: "{{ item.item.type }}"
    filename: "{{ kube_config_dir }}/{{ item.item.file }}"
    state: "latest"
  register: result
  until: result is succeeded
  retries: 10
  delay: 6
  with_items: "{{ psp_manifests.results }}"
  when:
    - inventory_hostname == groups['kube-master'][0]
    - not item is skipped
  loop_control:
    label: "{{ item.item.file }}"

which is in https://github.com/kubernetes-sigs/kubespray/blob/324106e91e3febdf75228b0883fff170bb28984c/roles/kubernetes-apps/cluster_roles/tasks/main.yml#L43

Is there I miss something to create a "new" module/action with 'kube'?

Thanks in advance!

whoami
  • 11
  • 1
  • 2

1 Answers1

1

Ok, let me answer by myself. Obviously, the reason is 'kube' module absent. So, it must be somewhere to define the 'kube' module. Yes, it is in the kubespray/library/kube.py

whoami
  • 11
  • 1
  • 2
  • It's because you are not running ansible-playbook from the kubespray directory, as it [contains an `ansible.cfg`](https://github.com/kubernetes-sigs/kubespray/blob/v2.13.0/ansible.cfg) which [adds `library` to the search path](https://github.com/kubernetes-sigs/kubespray/blob/v2.13.0/ansible.cfg#L17) – mdaniel May 08 '20 at 19:15
  • Yes, it is. Thanks!! – whoami May 09 '20 at 02:06