main.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. # Variables affecting this role:
  3. #
  4. # tools:
  5. # - final_name: the path to the tool to check for
  6. # completion: look for bash_completion or no
  7. # completion_file: the name of the bash completion file
  8. # clusters:
  9. # just a simple list of clusters to check
  10. #
  11. - name: Check for tools
  12. file:
  13. path: "{{ tools[item].final_name }}"
  14. state: file
  15. loop: "{{ tools.keys() | list }}"
  16. - name: Check for completion files
  17. file:
  18. path: /etc/bash_completion.d/{{ tools[item].completion_file }}
  19. state: file
  20. when: tools[item].completion
  21. loop: "{{ tools.keys() | list }}"
  22. - name: Make sure kubeconfig is there on utility
  23. delegate_to: utility.lab.example.com
  24. file:
  25. path: /home/lab/{{ item }}/auth/kubeconfig
  26. state: file
  27. loop: "{{ clusters }}"
  28. - name: Create a temp dir
  29. file:
  30. path: tmp
  31. state: directory
  32. - name: Copy over the kubeconfig
  33. delegate_to: utility.lab.example.com
  34. fetch:
  35. src: /home/lab/{{ item }}/auth/kubeconfig
  36. dest: tmp/kubeconfig-{{ item }}
  37. flat: yes
  38. loop: "{{ clusters }}"
  39. - name: "We need python-kubernetes >= 12"
  40. become: yes
  41. pip:
  42. name: kubernetes>=12.0.0
  43. - name: Verify cluster connectivity
  44. kubernetes.core.k8s_cluster_info:
  45. kubeconfig: tmp/kubeconfig-{{ item }}
  46. validate_certs: no
  47. loop: "{{ clusters }}"
  48. - name: Check RHSSO ZIP is there
  49. stat:
  50. path: "{{ ansible_facts['user_home'] }}/Downloads/rh-sso-{{ sso_z }}-server-dist.zip"
  51. register: sso_zip
  52. when: need_zip
  53. - assert:
  54. that: sso_zip.stat.exists
  55. when: need_zip
  56. ...