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

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

- name: Create an instance of Prometheus
  k8s:
    state: '{{ "present" if servicetelemetry_vars.backends.metrics.prometheus.enabled else "absent" }}'
    definition:
      '{{ prometheus_manifest }}'

# TODO: Create route to access Prometheus (conditional, default off)
