---

- name: Deploy monitoring resources
  include_tasks: deploy_resources.yml
  vars:
    values_file: /tmp/metering-values.yaml
    resources:
      - template_file: templates/monitoring/monitoring-rbac.yaml
        apis: [ {kind: role, api_version: 'rbac.authorization.k8s.io/v1'}, {kind: rolebindings, api_version: 'rbac.authorization.k8s.io/v1'} ]
        prune_label_value: metering-monitoring-rbac
        create: "{{ meteringconfig_create_metering_monitoring_rbac }}"
      - template_file: templates/monitoring/hdfs-service-monitor.yaml
        apis: [ {kind: serviceMonitor, api_version: 'monitoring.coreos.com/v1'} ]
        prune_label_value: metering-hdfs-service-monitor
        create: "{{ meteringconfig_create_metering_monitoring_resources }}"
      - template_file: templates/monitoring/hive-service-monitor.yaml
        apis: [ {kind: serviceMonitor, api_version: 'monitoring.coreos.com/v1'} ]
        prune_label_value: metering-hive-service-monitor
        create: "{{ meteringconfig_create_metering_monitoring_resources }}"
      - template_file: templates/monitoring/presto-service-monitor.yaml
        apis: [ {kind: serviceMonitor, api_version: 'monitoring.coreos.com/v1'} ]
        prune_label_value: metering-presto-service-monitor
        create: "{{ meteringconfig_create_metering_monitoring_resources }}"
      - template_file: templates/monitoring/reporting-operator-service-monitor.yaml
        apis: [ {kind: serviceMonitor, api_version: 'monitoring.coreos.com/v1'} ]
        prune_label_value: metering-reporting-operator-service-monitor
        create: "{{ meteringconfig_create_metering_monitoring_resources }}"

