# SPDX-License-Identifier: MIT
---
- name: Check if bpftrace pmda is registered
  command: pmprobe -I pmcd.agent.status
  register: status
  until: status.stdout.find("bpftrace") != -1
  retries: 10
  delay: 1
  changed_when: false
  when: __metrics_is_booted | bool

- name: Check if allowed users of bpftrace are configured
  shell: >-
    set -euo pipefail;
    grep -w '^allowed_users' /var/lib/pcp/pmdas/bpftrace/bpftrace.conf
    | grep -wq '{{ __test_uname }}'
  changed_when: false

- name: Check the ansible_managed header in the configuration file
  vars:
    __test_config_path: /var/lib/pcp/pmdas/bpftrace/bpftrace.conf
  include_tasks: check_header.yml
