main.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. # Variables affecting this role:
  3. #
  4. # tools:
  5. # - final_name: the name of the tool to check for
  6. # completion: look for bash_completion or no
  7. # clusters:
  8. # just a simple list of clusters to check
  9. #
  10. # TODO: move clusters somewhere else than vars/ and perhaps make it richer
  11. #
  12. - name: Check for tools
  13. file:
  14. path: "{{ tools[item].final_name }}"
  15. state: file
  16. loop: "{{ tools.keys() | list }}"
  17. - name: Check for completion files
  18. file:
  19. path: /etc/bash_completion.d/{{ tools[item].completion_file }}
  20. state: file
  21. when: tools[item].completion
  22. loop: "{{ tools.keys() | list }}"
  23. - name: Make sure kubeconfig is there on utility
  24. delegate_to: utility.lab.example.com
  25. file:
  26. path: /home/lab/{{ item }}/auth/kubeconfig
  27. state: file
  28. loop: "{{ clusters }}"
  29. - name: Create a temp dir
  30. file:
  31. path: tmp
  32. state: directory
  33. - name: Copy over the kubeconfig
  34. delegate_to: utility.lab.example.com
  35. fetch:
  36. src: /home/lab/{{ item }}/auth/kubeconfig
  37. dest: tmp/kubeconfig-{{ item }}
  38. flat: yes
  39. loop: "{{ clusters }}"
  40. - name: "We need python-kubernetes >= 12"
  41. become: yes
  42. pip:
  43. name: kubernetes>=12.0.0
  44. - name: Verify cluster connectivity
  45. kubernetes.core.k8s_cluster_info:
  46. kubeconfig: tmp/kubeconfig-{{ item }}
  47. validate_certs: no
  48. loop: "{{ clusters }}"
  49. ...