---
# Einfaches Monitoring ohne Prometheus

- name: Create simple monitoring script
  template:
    src: simple-monitor.sh.j2
    dest: /usr/local/bin/cdn-monitor
    mode: '0755'

- name: Setup monitoring cron job
  cron:
    name: "CDN Health Monitor"
    minute: "*/5"
    job: "/usr/local/bin/cdn-monitor"
    user: root

- name: Create log rotation for monitoring logs
  copy:
    content: |
      /var/log/nginx/cdn-monitor.log {
          weekly
          missingok
          rotate 4
          compress
          delaycompress
          notifempty
      }
    dest: /etc/logrotate.d/cdn-monitor
    mode: '0644'
