# Operator workflow

Keep checks as small, reviewable YAML files. Developers define the service contract; operators own deployment, scheduling and alert routing in existing tooling.

## Native packages

On Debian/Ubuntu/Raspberry Pi OS: `apt install python3 python3-requests python3-yaml ca-certificates`.

On AlmaLinux/Rocky Linux: `dnf install python3 python3-requests python3-pyyaml ca-certificates` (repository availability may vary).

## Offline inspection

```sh
python3 ipsonic-probe.py --version
python3 ipsonic-probe.py --validate examples/138-hello-first-tcp-ssh.yaml
python3 ipsonic-probe.py --explain examples/138-hello-first-tcp-ssh.yaml
python3 ipsonic-probe.py --dry-run examples/138-hello-first-tcp-ssh.yaml
python3 ipsonic-probe.py --list-checks examples/ --format tsv > checks.tsv
python3 ipsonic-probe.py --list-checks examples/ --format json > checks.json
```

`--validate`, `--explain`, `--dry-run` and `--list-checks` do not open network connections. Inventory is **non-recursive**, includes `.yaml` and `.yml` files, and sorts by filename. Use `--list-checks DIRECTORY` for inventory and `--check-dir DIRECTORY` to actually execute all checks.

## Execute a directory

```sh
python3 ipsonic-probe.py --check-dir /etc/ipsonic-probe/checks/ --output nagios
```

Execution is sequential. Exit status: 0 OK, 1 WARNING, 2 CRITICAL, 3 UNKNOWN. A configuration error results in UNKNOWN. Use an existing scheduler/monitoring platform; this tool does not install a daemon.

## Optional metadata

```yaml
metadata:
  owner: application-team
  environment: production
  description: Public SSH reachability check
  runbook: https://docs.example.org/runbooks/ssh
  tags:
    - infrastructure
    - critical
```

Metadata is informational, validated offline and displayed in `--explain` and inventory output. It does not change check behavior. Never place secrets in metadata or commit them into YAML.

## Ansible workflow

```yaml
- name: Validate all check configurations before execution
  ansible.builtin.command:
    argv:
      - /usr/bin/python3
      - /opt/ipsonic-probe/ipsonic-probe.py
      - --validate
      - /etc/ipsonic-probe/checks/api.yaml
  changed_when: false

- name: Run deployed checks
  ansible.builtin.command:
    argv:
      - /usr/bin/python3
      - /opt/ipsonic-probe/ipsonic-probe.py
      - --check-dir
      - /etc/ipsonic-probe/checks
  register: ipsonic_probe_result
  changed_when: false
  no_log: true  # use when checks require secrets
```

Deploy check YAML files to `/etc/ipsonic-probe/checks/` separately. The existing preparation playbook does not create application-specific checks. Ansible fails on nonzero monitoring status by default; handle that explicitly if a report-only run is desired.
