60 lines
2.8 KiB
YAML
60 lines
2.8 KiB
YAML
---
|
|
# sms-wa-bridge as a rootless Podman Quadlet unit on emily, behind the shared
|
|
# Caddy unit (caddy/playbook.yml).
|
|
#
|
|
# The app is SMS webhook -> routing rules -> WhatsApp, with no LLM in the path:
|
|
# an Android automation (MacroDroid) POSTs each SMS to https://bridge.tanshu.dev/sms
|
|
# with an X-Auth header, rules.json decides who gets it, and whatsapp-web.js
|
|
# sends it from a linked WhatsApp account. It was deployed on monoco as a plain
|
|
# `docker run` container built from the Dockerfile now vendored at
|
|
# files/build/ — see readme.md.
|
|
#
|
|
# Connects as the container user and runs everything as that user: the Quadlet
|
|
# units belong to it, so the connection's PAM session is what makes
|
|
# `systemctl --user` work without any environment juggling.
|
|
#
|
|
# gather_facts is required: podman_user and the home directory come from the
|
|
# user_id / user_dir facts.
|
|
#
|
|
# The rootless-Podman prerequisites (installing podman, enabling lingering, the
|
|
# low-port sysctl, creating the Quadlet directory) are deliberately NOT applied
|
|
# here. They are the shared task file at caddy/roles/podman/tasks/main.yaml, and
|
|
# a host that has already run caddy/playbook.yml has them:
|
|
#
|
|
# - name: Rootless Podman prerequisites
|
|
# ansible.builtin.include_tasks: "{{ playbook_dir }}/../caddy/roles/podman/tasks/main.yaml"
|
|
#
|
|
# The variables this play needs are duplicated at the top of vars/default.yml, so
|
|
# it stands on its own. (Applying the commented include above would also need
|
|
# podman_unprivileged_port_start, which lives in caddy/vars/default.yml.)
|
|
#
|
|
# The one prerequisite it *does* need beyond Caddy's is buildah, and only on the
|
|
# build path: `podman` Recommends it on Ubuntu, so caddy/roles/podman has already
|
|
# installed it. Nothing needs it when the image is loaded from monoco, which is
|
|
# the recommended route in readme.md.
|
|
#
|
|
# Run with: ansible-playbook -u tanshu sms-wa-bridge/playbook.yml
|
|
- name: Deploy sms-wa-bridge as a rootless Podman Quadlet
|
|
hosts: emily
|
|
gather_facts: true
|
|
vars_files:
|
|
- vars/default.yml
|
|
|
|
pre_tasks:
|
|
# This must happen before the app unit is started, not after: the generated
|
|
# unit references {{ network_name }}.network, and Quadlet fails *unit
|
|
# generation* (so `systemctl --user start` reports "unit not found") when a
|
|
# referenced .network file does not exist yet. The same include writes the
|
|
# Caddy-side drop-in that attaches Caddy to this network.
|
|
#
|
|
# network_name is a play var, so the include can see it directly.
|
|
- name: Register the bridge's network with Caddy
|
|
ansible.builtin.include_tasks: "{{ playbook_dir }}/../caddy/roles/register/tasks/main.yaml"
|
|
|
|
roles:
|
|
# The app: the data tree and the two bind-mounted files, the environment
|
|
# file, the image (loaded or built), the Quadlet unit, start + verify.
|
|
- sms-wa-bridge
|
|
# Appends this site's block to the shared Caddyfile and reloads Caddy.
|
|
- caddy
|