diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2026-08-04 12:00:39 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2026-08-04 12:00:39 +0300 |
| commit | d38fe54ab035f8e3248b8e20a58abd89861833bf (patch) | |
| tree | fcc78428a726799568a1ae2253a16590e883c816 /roles/jails/20_immich/templates/jail.conf.j2 | |
| parent | 017b29539749da3c62202879d757a45ffc71208c (diff) | |
Simplify jail configuration
Diffstat (limited to 'roles/jails/20_immich/templates/jail.conf.j2')
| -rw-r--r-- | roles/jails/20_immich/templates/jail.conf.j2 | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/roles/jails/20_immich/templates/jail.conf.j2 b/roles/jails/20_immich/templates/jail.conf.j2 index 13680af..8e3c626 100644 --- a/roles/jails/20_immich/templates/jail.conf.j2 +++ b/roles/jails/20_immich/templates/jail.conf.j2 @@ -13,26 +13,22 @@ immich { enforce_statfs = 1; devfs_ruleset = 4; - host.hostname = "immich"; - path = "/usr/local/jails/containers/immich"; + host.hostname = "${name}"; + path = "/usr/local/jails/containers/${name}"; exec.start = "/bin/sh /etc/rc"; exec.stop = "/bin/sh /etc/rc.shutdown"; - # LAN epair - exec.prestart += "ifconfig epl{{ jail_num }}a destroy 2>/dev/null || true"; - exec.prestart += "ifconfig epair{{ jail_num }}000 create"; - exec.prestart += "ifconfig epair{{ jail_num }}000a name epl{{ jail_num }}a"; - exec.prestart += "ifconfig epair{{ jail_num }}000b name epl{{ jail_num }}b"; - exec.prestart += "ifconfig epl{{ jail_num }}b ether random"; - exec.prestart += "ifconfig brlan0 addm epl{{ jail_num }}a"; - exec.poststart += "ifconfig epl{{ jail_num }}b vnet immich"; - exec.poststart += "ifconfig epl{{ jail_num }}a up"; - exec.poststart += "jexec immich ifconfig epl{{ jail_num }}b up"; - exec.poststart += "jexec immich ifconfig epl{{ jail_num }}b {{ jail_lan_cidr | ipv4_nth_cidr(jail_num | int + jail_lan_offset | int) }}"; - exec.poststart += "jexec immich route delete default || true"; - exec.poststart += "jexec immich route add default {{ ingress_ip }} || true"; - exec.poststop += "ifconfig epl{{ jail_num }}a destroy 2>/dev/null || true"; + # Networking + exec.prestart += "jail_net prestart {{ jail_num }} ${name}"; + exec.poststart += "jail_net poststart {{ jail_num }} ${name}"; + exec.prestop += "jail_net prestop {{ jail_num }} ${name}"; + exec.poststop += "jail_net poststop {{ jail_num }} ${name}"; + + # nullfs mounts +{% for mount in nullfs | default([]) | normalize_nullfs %} + mount += "{{ mount.src }} ${path}{{ mount.dst }} nullfs {{ mount.mode | default('rw') }} 0 0"; +{% endfor %} {% for img in oci_images %} # Mounts for {{ img.name }} rootfs @@ -41,8 +37,5 @@ immich { mount += "devfs $path/image/{{ img.name }}/dev devfs rw 0 0"; mount += "tmpfs $path/image/{{ img.name }}/tmp tmpfs rw 0 0"; mount += "tmpfs $path/image/{{ img.name }}/run tmpfs rw 0 0"; -{% for mnt in img.mounts | default([]) %} - mount += "$path{{ mnt.src }} $path/image/{{ img.name }}{{ mnt.dst }} nullfs rw 0 0"; -{% endfor %} {% endfor %} } |
