#!/bin/bash
key='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/4BTstRm+4+uNwbU7xjK9Ip+HdpGuvEbBwT/lSVCwj golubev@deb'
hostname=files.<org>.omx

vmid=$(pvesh get /cluster/nextid)
ostemplate=local:vztmpl/$(cd /var/lib/vz/template/cache; ls -1 debian-12-standard_*_amd64.* | tail -n1)
pct create $vmid $ostemplate --ostype debian \
    --start 0 \
    --onboot 1 \
    --protection 1 \
    --unprivileged 0 \
    --timezone Europe/Kyiv \
    --hostname $hostname \
    --searchdomain ${hostname#*.} \
    --rootfs vmlxc:2 \
    --mp0 vmlxc:2,mp=/var/samba,acl=1 \
    --net0 name=lan0,ip=dhcp,bridge=vmbr0 \
    --memory 2048 --swap 1024 \
    --ssh-public-keys <(echo $key)

zfs set aclinherit=passthrough rpool/vmlxc/subvol-$vmid-disk-1

#    --features nesting=1 \
