--- # The mozimo service itself: registry credentials, the pinned image, and the # Quadlet unit that systemd turns into a user service. # # There is one unit, not two: the image's entrypoint runs the SSR server and # PocketBase side by side, so the pair restart together. - name: Check the rootless podman installation ansible.builtin.command: podman --version changed_when: false - name: Log in to the registry as the podman user ansible.builtin.command: cmd: "podman login --username {{ username }} --password-stdin {{ registry }}" stdin: "{{ password }}" no_log: true changed_when: false - name: Pull the image for this revision ansible.builtin.command: "podman pull {{ image }}" # the pull is a means to an end; the restart handler reports the real change changed_when: false - name: Install the mozimo Quadlet unit ansible.builtin.template: src: mozimo.container.j2 dest: "{{ quadlet_dir }}/{{ title }}.container" mode: "0644" notify: Restart Mozimo # Explicit, and before the handlers run: the unit does not exist as a systemd # service until the podman user generator has seen it, so generating it here # means the restart handler has something to restart on a first deploy. - name: Generate the user service from the Quadlet unit ansible.builtin.systemd_service: daemon_reload: true scope: user - name: Prune old mozimo images, keep newest 3 (opt-in via ./deploy.sh --prune) ansible.builtin.shell: > podman images -q {{ registry }}/{{ title }} | tail -n +4 | xargs -r podman rmi when: mozimo_image_prune | default(false) | bool failed_when: false changed_when: true