Mprdb
Версия от 15:57, 31 мая 2021; Vovan (обсуждение | вклад) (→Набор действий (вручную) для настройки одного узла)
Содержание
Подготовка PVE ноды после клонирования из базового образа
Где лежит базовый образ?
apve3: /mnt/samba/fdisk3/pve-base-image.dd
Скрипты переименования машин
Выполнить из pmagic
MACHINE_NAME='pve-prdb-01' DISK='/dev/nvme0n1' # fix gdisk $DISK <<EOF x e w Y EOF # resize lvm partition gdisk $DISK <<EOF d 3 n 3 w Y EOF # refresh partitions partprobe # resize pv pvresize "${DISK}p3" # rescan volume groups vgchange -ay # create lvm and zfs pool in this lvcreate pve-vg --name vmstorage -L 400g # reboot to debian reboot
Выполнить из pve
MACHINE_NAME='pve-prdb-01' zpool create zfspool /dev/mapper/pve--vg-vmstorage -f zfs set compression=off zfspool zfs set sync=disabled zfspool mkdir /zfspool/storage chown storage:storage /zfspool/storage -R # detect ip IP=$(ip a | grep eth0 | tail -1 | awk {'print $2'} | awk -F '/' {'print $1'}) # replace template config cd /opt/node_template_config mv /var/lib/rrdcached/db/pve2-node/pve-analise-xx /var/lib/rrdcached/db/pve2-node/$MACHINE_NAME mv /var/lib/rrdcached/db/pve2-storage/pve-analise-xx /var/lib/rrdcached/db/pve2-storage/$MACHINE_NAME systemctl stop pve-cluster systemctl stop corosync pmxcfs -l mv /etc/pve/nodes/pve-analise-xx /etc/pve/nodes/$MACHINE_NAME killall pmxcfs cd / tar -xzpf /opt/node_template_config/etc.tgz sed -i "s/TEMPLATENAME/$MACHINE_NAME/g" /etc/hosts sed -i "s/TEMPLATEIPADDR/$IP/g" $DISKDIR/etc/hosts sed -i "s/TEMPLATENAME/$MACHINE_NAME/g" /etc/hostname sed -i "s/TEMPLATENAME/$MACHINE_NAME/g" /etc/mailname sed -i "s/TEMPLATENAME/$MACHINE_NAME/g" /etc/postfix/main.cf reboot
Доустановить и настроить SAMBA
apt-get install samba adduser storage smbpasswd -a storage smbpasswd -e storage
mkdir /zfspool/storage chown storage:storage /zfspool/storage -R
положить это в
/etc/samba/smb.conf
# Global parameters [global] log file = /var/log/samba/log.%m logging = file map to guest = Bad User max log size = 1000 obey pam restrictions = Yes pam password change = Yes panic action = /usr/share/samba/panic-action %d passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . passwd program = /usr/bin/passwd %u server role = standalone server server string = %h server (Samba, Ubuntu) unix password sync = Yes usershare allow guests = Yes idmap config * : backend = tdb [storage] browseable = Yes comment = storage valid users = storage create mask = 0755 directory mask = 0755 path = /zfspool/storage read only = No veto files = /._*/.DS_Store/.T*/Thumbs.db/Network Trash Folder/Temporary Items/*.exe/*.bat/*.msi delete veto files = yes