Files
ansible-role-monero/README.md
T
claudeandClaude Opus 5.5 946256a3dd Publish sanitized P2Pool hashrate stats
Enable P2Pool's --data-api/--local-api and add a small stdlib-only sidecar
that copies an allowlist of numeric fields (node/sidechain hashrate,
connected miners, shares, network difficulty) to /p2pool/stats.json. Worker
IPs and wallet fragments in local/stratum are never served.

An Ingress adds that single path to the website host (www.eom.dev by
default), so the homepage can read it same-origin and reuse its TLS cert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018STDcc5BaYxPMNA9S8Wycs
2026-11-08 02:37:26 +00:00

2.4 KiB

ansible-role-monero

Deploys a Monero node (monerod) and a P2Pool node to Kubernetes, in the monero namespace. Miners point xmrig at the P2Pool service on port 3333.

Role Variables

Required, from Vault:

  • monerod_user, monerod_password: monerod's RPC login. Stored in the monerod-rpc Secret and passed to both containers through an environment variable, so it doesn't show in the Deployment specs.
  • monero_p2pool_wallet_address: the address P2Pool pays out to.

Optional:

  • monero_p2pool_chain (default nano): main, mini or nano. Match it to your total hashrate; see the note in defaults/main.yml. Switching chains starts from zero shares on the new chain, and shares on the old one stop earning once they leave its PPLNS window.
  • monero_p2pool_addpeers (default []): extra P2Pool peers as host:port. They must be on the same chain.
  • monero_p2pool_stats_host (default www.eom.dev): website host that gets the public /p2pool/stats.json path. Use "" to keep stats internal.
  • monero_p2pool_stats_ingress_class (default nginx), monero_p2pool_stats_image (default python:3.13-alpine).

Public stats

P2Pool runs with --data-api /api --local-api. Those files include miner IP addresses, so they are never served. A stats sidecar (files/p2pool_stats.py, standard library only) copies an allowlist of numeric fields into one JSON document:

{"sidechain": "nano",
 "node":    {"hashrate_15m", "hashrate_1h", "hashrate_24h", "miners",
             "shares_found", "shares_failed", "current_effort",
             "average_effort", "reward_share_percent",
             "last_share_found_time", "updated_at", "stale"},
 "pool":    {"hashrate", "miners", "difficulty", "height", "blocks_found",
             "last_block_found_time", "pplns_window", "updated_at", "stale"},
 "network": {"hashrate", "difficulty", "height", "reward_xmr",
             "updated_at", "stale"}}

node is this P2Pool instance (everyone mining through it); pool is the whole sidechain. Sections are null until P2Pool writes them, and the endpoint answers 503 until node exists. Run the sidecar's tests with python3 -m unittest discover -s tests.

Example Playbook

- hosts: alpha-control-plane
  become: true
  vars_files:
    - ../secrets.yaml
  roles:
    - role: ericomeehan.monero

License

MIT-0