# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
- name: Check if grafana-pcp datasources are configured
  uri:
    url: "http://admin:admin@localhost:3000/api/datasources/name/PCP%20{{ item }}"
    force_basic_auth: true
    headers:
      Content-Type: application/json
      Accept: application/json
    method: GET
    status_code: 200
  loop:
    - Redis
    - Vector
    - bpftrace
  when:
    - __metrics_is_booted | bool
    - ansible_distribution in ['RedHat', 'CentOS']
    - ansible_distribution_major_version | int > 6
    - ansible_distribution_major_version | int < 10

- name: Check if grafana-pcp datasources are configured
  uri:
    url: "http://admin:admin@localhost:3000/api/datasources/name/PCP%20{{ item }}"
    force_basic_auth: true
    headers:
      Content-Type: application/json
      Accept: application/json
    method: GET
    status_code: 200
  loop:
    - Valkey
    - Vector
    - bpftrace
  when:
    - __metrics_is_booted | bool
    - (ansible_distribution in ['RedHat', 'CentOS'] and
       ansible_distribution_major_version | int >= 10) or
       ansible_distribution not in ['RedHat', 'CentOS']

# yamllint enable rule:line-length
