Simple Ansible Playbooks that demonstrate how zuginfo.nrw's API can be used to send infos concerning railway lines to custom WebPush or UnifiedPush endpoints.
Find a file
2026-01-06 20:52:22 +01:00
zuginfo_playbooks read some more values from account.txt 2026-01-06 20:52:22 +01:00
.gitignore add .gitignore 2026-01-06 20:47:35 +01:00
README.md document this a bit 2026-01-06 20:47:50 +01:00

zuginfo_nrw_webpush_ansible

Simple Ansible Playbooks that demonstrate how zuginfo.nrw's API can be used to send infos concerning railway lines to custom WebPush or UnifiedPush endpoints.

How to Use

Creating an account

Run the Playbooks using Ansible:

cd zuginfo_playbooks
ansible-playbook zuginfo_api_create_account.yml

Save the values to files/account.txt before you continue.

Example:

account:
  aid: "12345"
  mysterious_id: "12345"

Create Subscription to your WebPush Endpoint

Amend files/account.txt:

account:
  aid: "12345"
  mysterious_id: "12345"
  push_endpoint: "https://example.org/up/push/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  push_key_auth: "auth_secret"
  push_key_p256dh: "auth_key"

Run the Playbook:

ansible-playbook zuginfo_api_create_webpush_subscription.yml

This will return user_id and channel_id. Amend files/account.txt.

account:
  aid: "12345"
  mysterious_id: "12345"
  push_endpoint: "https://example.org/up/push/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  push_key_auth: "auth_secret"
  push_key_p256dh: "auth_key"
  user_id: "12345"
  channel_id: "12345"

Subscribing to a specific railway line

to do

Random Notes

  • user_id seems to change when all subscriptions are deleted and a new one is added
  • channel_id seems to change when all subscriptions are deleted and a new one is added
  • subscriptions have to be deleted before an account can be deleted