install_eventrouter.yaml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # allow passing in a tempdir
  7. - name: Create temp directory for doing work in
  8. command: mktemp -d /tmp/openshift-logging-ansible-XXXXXX
  9. register: mktemp
  10. changed_when: False
  11. - set_fact:
  12. tempdir: "{{ mktemp.stdout }}"
  13. - name: Create templates subdirectory
  14. file:
  15. state: directory
  16. path: "{{ tempdir }}/templates"
  17. mode: 0755
  18. changed_when: False
  19. # create EventRouter deployment config
  20. - name: Generate EventRouter template
  21. template:
  22. src: eventrouter-template.j2
  23. dest: "{{ tempdir }}/templates/eventrouter-template.yaml"
  24. vars:
  25. node_selector: "{{ openshift_logging_eventrouter_nodeselector | default({}) }}"
  26. - name: Create EventRouter template
  27. oc_obj:
  28. namespace: "{{ openshift_logging_eventrouter_namespace }}"
  29. kind: template
  30. name: eventrouter-template
  31. state: present
  32. files:
  33. - "{{ tempdir }}/templates/eventrouter-template.yaml"
  34. - name: Process EventRouter template
  35. oc_process:
  36. state: present
  37. template_name: eventrouter-template
  38. namespace: "{{ openshift_logging_eventrouter_namespace }}"
  39. params:
  40. IMAGE: "{{openshift_logging_eventrouter_image_prefix}}logging-eventrouter:{{openshift_logging_eventrouter_image_version}}"
  41. REPLICAS: "{{ openshift_logging_eventrouter_replicas }}"
  42. CPU: "{{ openshift_logging_eventrouter_cpu_request }}"
  43. MEMORY: "{{ openshift_logging_eventrouter_memory_limit }}"
  44. NAMESPACE: "{{ openshift_logging_eventrouter_namespace }}"
  45. SINK: "{{ openshift_logging_eventrouter_sink }}"
  46. ## Placeholder for migration when necessary ##
  47. - name: Delete temp directory
  48. file:
  49. name: "{{ tempdir }}"
  50. state: absent
  51. changed_when: False