proxmox-management/create_organisation
2026-01-04 15:22:38 +01:00

32 lines
948 B
Bash
Executable file

#!/bin/sh
set -e
ZFS_PARENT_PATH=rpool/customer
ORGA=$1
usage() {
printf "usage: %s <organisation_name>\n" $0
}
# check if we where correctly called
[ $# != 1 ] && usage && exit 1
# create group for organisation
pveum group add "${ORGA}" --comment "group for the organisation '${ORGA}'"
# create resource pool for the organisation
pveum pool add "${ORGA}" --comment "pool for the organisation '${ORGA}'"
# allow group to access resource pool
pveum acl modify "/pool/${ORGA}/" --roles PVEPoolUser,PVEVMUser,PVEDatastoreAdmin,RDNTZVMSnapshot,RDNTZVMOptions --groups "${ORGA}"
# create zfs filesystem for isos, backups and stuff
zfs create -o quota=150G -p "${ZFS_PARENT_PATH}/${ORGA}-images"
# create proxmox storage ontop of zfs filesystem
pvesm add dir "${ORGA}-images" --path "/${ZFS_PARENT_PATH}/${ORGA}-images" --content vztmpl,iso,backup,backup
# add storage into storage pool
pveum pool modify "${ORGA}" --storage "${ORGA}-images"