# 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

- name: Check if allowed users of bpftrace are configured
  changed_when: false
  shell: |
    set -eu
    if set -o | grep -q pipefail; then
      set -o pipefail  # no pipefail on debian, some ubuntu
    fi
    grep -w '^allowed_users' /var/lib/pcp/pmdas/bpftrace/bpftrace.conf \
    | grep -wq '{{ __test_uname }}'
