--- # Deploys the menu app for one or more Sites as rootless Podman Quadlet units on # emily, behind the fleet's shared Caddy unit (caddy/playbook.yml in the # ansible-playbooks repo). It lives here, beside the app it deploys. # # 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` and `podman exec` work without any environment juggling. # There is deliberately no `become`: root-only prerequisites (Podman, # `loginctl enable-linger`, the low-port sysctl Caddy needs) belong to # caddy/playbook.yml, which must have run on this host first. # # gather_facts is required: podman_user, podman_data_dir and quadlet_dir are # derived from the user_id / user_dir facts. # # The inventory is the one difference from the sibling apps, which deploy a # single app: this play carries three Sites and a var_file per Site. # # ./deploy.sh (repo root) # SITE=greatbear ./deploy.sh one Site # cd ansible && ansible-playbook -u tanshu --inventory=hosts playbook.yml -e image_tag= - name: Deploy the menu app as rootless Podman Quadlets hosts: menus gather_facts: true vars_files: - vars/default.yml pre_tasks: - name: Load the vars file this Site names in the inventory ansible.builtin.include_vars: file: '{{ var_file }}' when: var_file is defined # 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. - name: Register this Site's network with Caddy ansible.builtin.include_tasks: '{{ playbook_dir }}/roles/register/tasks/main.yaml' roles: # The app: the data directory tree, the Quadlet unit, start + verify. - menu-app # Appends this Site's block to the shared Caddyfile and reloads Caddy. - caddy