--- # Gitea as a rootless Podman Quadlet unit on emily, behind the shared Caddy # unit (caddy/playbook.yml), with git-over-SSH still arriving on the host's own # port 22 so that no client has to change its remote. # # 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.) # # Unlike bitwarden/ and tandoor/ there is no postgres role here: this Gitea runs # on SQLite, which monoco's live app.ini confirms (`DB_TYPE = sqlite3`, # `PATH = /data/gitea/gitea.db`). The unused Docker-era Postgres variant that # used to sit beside this file was removed for the same reason. # # Run with: ansible-playbook -u tanshu gitea/playbook.yml - name: Deploy Gitea 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 Gitea's network with Caddy ansible.builtin.include_tasks: "{{ playbook_dir }}/../caddy/roles/register/tasks/main.yaml" roles: # The host half of git-over-SSH: the `git` login user, the passthrough shim, # the authorized_keys hook, the sshd drop-in and the one-command sudoers # rule. Root-only steps elevate individually — see the role for why. - ssh # The app: the data directory tree the image's own root phase would leave # subuid-owned, the Quadlet unit, start + verify. - gitea # Appends this site's block to the shared Caddyfile and reloads Caddy. - caddy