- name: Lookup template
  debug:
    msg: "{{ lookup('template', './manifest_elasticsearch.j2') | from_yaml }}"

- name: Set default ElasticSearch manifest
  set_fact:
    elasticsearch_manifest: "{{ lookup('template', './manifest_elasticsearch.j2') | from_yaml }}"
  when: elasticsearch_manifest is not defined

- name: Create an instance of ElasticSearch
  k8s:
    state: '{{ "present" if servicetelemetry_vars.backends.events.elasticsearch.enabled else "absent" }}'
    definition:
      '{{ elasticsearch_manifest }}'
