install_eventrouter.yaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ---
  2. # initial checks
  3. - assert:
  4. msg: Invalid sink type "{{openshift_logging_eventrouter_sink}}", only one of "{{__eventrouter_sinks}}" allowed
  5. that: openshift_logging_eventrouter_sink in __eventrouter_sinks
  6. - name: Ensure that Logging EventRouter has nodes to run on
  7. import_role:
  8. name: openshift_control_plane
  9. tasks_from: ensure_nodes_matching_selector.yml
  10. vars:
  11. openshift_master_ensure_nodes_selector: "{{ openshift_logging_eventrouter_nodeselector | map_to_pairs }}"
  12. openshift_master_ensure_nodes_service: Logging EventRouter
  13. # allow passing in a tempdir
  14. - name: Create temp directory for doing work in
  15. command: mktemp -d /tmp/openshift-logging-ansible-XXXXXX
  16. register: mktemp
  17. changed_when: False
  18. - set_fact:
  19. tempdir: "{{ mktemp.stdout }}"
  20. - name: Create templates subdirectory
  21. file:
  22. state: directory
  23. path: "{{ tempdir }}/templates"
  24. mode: 0755
  25. changed_when: False
  26. # create EventRouter deployment config
  27. - name: Generate EventRouter template
  28. template:
  29. src: "{{ __base_file_dir }}/eventrouter-template.j2"
  30. dest: "{{ tempdir }}/templates/eventrouter-template.yaml"
  31. vars:
  32. node_selector: "{{ openshift_logging_eventrouter_nodeselector | default({}) }}"
  33. - name: Create EventRouter template
  34. oc_obj:
  35. namespace: "{{ openshift_logging_eventrouter_namespace }}"
  36. kind: template
  37. name: eventrouter-template
  38. state: present
  39. files:
  40. - "{{ tempdir }}/templates/eventrouter-template.yaml"
  41. - name: Process EventRouter template
  42. oc_process:
  43. state: present
  44. template_name: eventrouter-template
  45. namespace: "{{ openshift_logging_eventrouter_namespace }}"
  46. params:
  47. IMAGE: "{{ openshift_logging_eventrouter_image }}"
  48. REPLICAS: "{{ openshift_logging_eventrouter_replicas }}"
  49. CPU: "{{ openshift_logging_eventrouter_cpu_request }}"
  50. MEMORY: "{{ openshift_logging_eventrouter_memory_limit }}"
  51. NAMESPACE: "{{ openshift_logging_eventrouter_namespace }}"
  52. SINK: "{{ openshift_logging_eventrouter_sink }}"
  53. ## Placeholder for migration when necessary ##
  54. - name: Delete temp directory
  55. file:
  56. name: "{{ tempdir }}"
  57. state: absent
  58. changed_when: False