logging-start.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. - name: Prepare for the logging exercise
  2. hosts: workstation.lab.example.com
  3. gather_subset: min
  4. become: no
  5. vars:
  6. ge_nsp: logging-central
  7. pre_tasks:
  8. - name: Make sure kubeconfig is there on utility
  9. delegate_to: utility.lab.example.com
  10. file:
  11. path: /home/lab/{{ item }}/auth/kubeconfig
  12. state: file
  13. loop: "{{ clusters }}"
  14. - name: Create a temp dir
  15. file:
  16. path: tmp
  17. state: directory
  18. - name: Copy over the kubeconfig
  19. delegate_to: utility.lab.example.com
  20. fetch:
  21. src: /home/lab/{{ item }}/auth/kubeconfig
  22. dest: tmp/kubeconfig-{{ item }}
  23. flat: yes
  24. loop: "{{ clusters }}"
  25. roles:
  26. - role: deploy-logging
  27. # post_tasks:
  28. # - name: Check whether the namespace is already there
  29. # k8s_info:
  30. # kubeconfig: tmp/kubeconfig-ocp4
  31. # validate_certs: no
  32. # api_version: v1
  33. # kind: namespace
  34. # name: "{{ ge_nsp }}"
  35. # register: ge_exists
  36. #
  37. # - name: Fail if the namespace exists
  38. # fail:
  39. # msg: "The exercise namespace already exists: {{ ge_nsp }}; please run strategy-finish.yml to clean up first and then re-run this playbook."
  40. # when: ge_exists.resources | length > 0
  41. #
  42. # - name: Ensure there is a namespace for the exercise
  43. # k8s:
  44. # kubeconfig: tmp/kubeconfig-ocp4
  45. # validate_certs: no
  46. # api_version: v1
  47. # kind: namespace
  48. # name: "{{ ge_nsp }}"
  49. ...