--- - name: 'Ensure required software is installed' become: true ansible.builtin.apt: name: 'podman' state: 'present' - name: 'Define caddy image' become: true containers.podman.podman_image: name: 'docker.io/library/caddy:latest' state: 'quadlet' notify: - 'Reload caddy services' - 'Restart caddy image' - name: 'Define caddy data volume' become: true containers.podman.podman_volume: name: 'caddy-data' state: 'quadlet' notify: - 'Reload caddy services' - 'Restart caddy volume' - name: 'Create caddy conf directory' become: true ansible.builtin.file: name: '/etc/caddy' state: 'directory' owner: 'root' group: 'root' mode: 'u=rwx,g=rx,o=rx' - name: 'Generate Caddyfile' become: true ansible.builtin.template: src: 'Caddyfile.j2' dest: '/etc/caddy/Caddyfile' owner: 'root' group: 'root' mode: 'u=rw,g=r,o=r' notify: - 'Restart caddy container' - name: 'Create caddy container' become: true containers.podman.podman_container: name: 'caddy' image: 'caddy.image' network: '{{ caddy_networks }}' state: 'quadlet' volume: - '/etc/caddy:/etc/caddy' - 'caddy-data.volume:/data' publish: - '80:80' - '443:443' quadlet_options: | [Install] WantedBy=default.target [Unit] Requires=caddy-image.service After=caddy-image.service Requires=caddy-data-volume.service After=caddy-data-volume.service {% for net in caddy_networks %} Requires={{ net | replace('.network', '-network') }}.service After={{ net | replace('.network', '-network') }}.service {% endfor %} notify: - 'Reload caddy services' - 'Restart caddy container'