---
# Monitoring role — Prometheus config + optional remote_write

- name: Generate Prometheus config
  ansible.builtin.template:
    src: prometheus.yml.j2
    dest: "{{ cml_deploy_path }}/configs/prometheus/prometheus.yml"
    mode: "0644"
  notify: Restart monitoring stack

- name: Start monitoring profile
  ansible.builtin.command:
    cmd: docker compose --profile monitoring up -d
    chdir: "{{ cml_deploy_path }}"
  changed_when: true
  when: cml_monitoring_enabled | bool
