--- # Defaults shared by every Site. Each Site's own file is named by the `var_file` # in ansible/hosts, and its slug is its inventory name. # --------------------------------------------------------------------------- # Rootless Podman / Quadlet # --------------------------------------------------------------------------- # podman_user is derived from the connection: this play carries no become, so the # Quadlet units belong to whoever Ansible connects as. Requires gather_facts # (set in playbook.yml). # # These three duplicate caddy/vars/default.yml in the ansible-playbooks repo, # which owns the Caddy unit these Sites sit behind. Keep them in sync. podman_user: "{{ ansible_facts['user_id'] }}" podman_data_dir: "{{ ansible_facts['user_dir'] }}/podman-data" quadlet_dir: "{{ ansible_facts['user_dir'] }}/.config/containers/systemd" # Which Site config inside the image to run, and which web address it serves. site: '{{ inventory_hostname }}' # --------------------------------------------------------------------------- # The app # --------------------------------------------------------------------------- image_name: registry.tanshu.com/menu-admin image_tag: "{{ tag | default('latest') }}" # The unit file is menu-.container and the Podman network is # menu-_net. The container keeps the Docker-era name, dots and all, because # scripts/provision-site-env.sh and anything an operator types look it up that # way — but a name with dots is a DNS liability, so the Caddyfile proxies to the # dotless NetworkAlias the unit sets beside it. network_name: 'menu-{{ site }}' unit_name: '{{ network_name }}.service' container_name: 'menu-app.{{ host }}' # The image's own account (`node`), which keep-id maps onto podman_user. app_uid: 1000 app_gid: 1000 container_port: 3000 # podman builds an OCI image by default and drops the Containerfile's # HEALTHCHECK instruction, so the unit declares the same check and the play gates # on it. node is in the image and the sh -c podman wraps it in handles the quotes. health_cmd: >- node -e "fetch('http://127.0.0.1:{{ container_port }}/healthz').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" # --------------------------------------------------------------------------- # The shared Caddy unit and its Caddyfile, both owned by the caddy playbook in # ansible-playbooks (caddy/playbook.yml). # --------------------------------------------------------------------------- caddy_name: caddy caddyfile_path: '{{ podman_data_dir }}/{{ caddy_name }}/conf/Caddyfile' caddy_snippet: | {{ host }} { reverse_proxy {{ network_name }}:{{ container_port }} }