# SPDX-License-Identifier: MIT
---
- name: Check if user exists
  command: id "{{ __test_uname }}"
  changed_when: false

- name: Check if password is configured
  shell: |
    set -euo pipefail
    sasldblistusers2 -f /etc/pcp/passwd.db | grep -wq "{{ __test_uname }}"
  changed_when: false

# yamllint disable rule:line-length
- name: Check if a client can access metrics
  command: pminfo -f -h "pcp://127.0.0.1?username={{ __test_uname }}&password={{ pcptest_pw }}" disk.dev.read
  changed_when: false
  when: __metrics_is_booted | bool
# yamllint enable rule:line-length
