32 lines
921 B
Bash
Executable file
32 lines
921 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 PVEVMUser,PVEDatastoreAdmin,RDNTZVMSnapshot --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"
|