vm-upload must be run as user root

This commit is contained in:
Raphael Dannecker 2024-02-05 12:59:23 +01:00
parent ccec0f7fea
commit d285b9dbf0
5 changed files with 7 additions and 19 deletions

View file

@ -22,4 +22,4 @@ lmnsynci ALL=(root) NOPASSWD: /usr/local/bin/vm-aria2
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/desktop-sync
# vm-upload:
%role-teacher ALL=(lmnsynci) NOPASSWD: /usr/local/bin/vm-upload
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/vm-upload

View file

@ -72,7 +72,7 @@ qemu-img rebase -f qcow2 -b "${NEWBASE}" -F qcow2 "${VM_NAME}.qcow2"
if [[ -v NEWNAME ]]; then
NEWNAME="${NEWNAME}.qcow2"
else
rm "${CURRENTBASE}"
rm -f "${CURRENTBASE}"
NEWNAME="${CURRENTBASE}"
fi

View file

@ -16,7 +16,7 @@ upload_image() {
echo "File not found ${VM_NAME}.qcow2" >&2
exit 1
fi
sudo vm-aria2 stop "${VM_NAME}" || echo "VMImage-torrent not running"
vm-aria2 stop "${VM_NAME}" || echo "VMImage-torrent not running"
# link private VM-Diskimage to system-Dir
if [[ -f "${VM_DIR}/${VM_NAME}.qcow2" \
&& ( -f "${VM_SYSDIR}/${VM_NAME}.qcow2" && ("${VM_DIR}/${VM_NAME}.qcow2" -nt "${VM_SYSDIR}/${VM_NAME}.qcow2") \
@ -26,6 +26,9 @@ upload_image() {
ln -f "${VM_DIR}/${VM_NAME}.qcow2" "${VM_SYSDIR}/${VM_NAME}.qcow2"
fi
cd "${VM_SYSDIR}"
if [[ -f "/tmp/${VM_NAME}.qcow2.torrent" ]]; then
rm -f "/tmp/${VM_NAME}.qcow2.torrent"
fi
uploadseed --server "${SEEDBOX_HOST}:${SEEDBOX_RPC_PORT}" --dht-port "${SEEDBOX_PORT}" \
--pwdfile "${SEEDBOX_PWFILE}" --no-cert "${VM_NAME}.qcow2"
}

View file

@ -3,14 +3,6 @@
name: libvirtd.service
listen: reload libvirtd
- name: Enable vmimage-torrent service
systemd:
name: vmimage-torrent.service
state: restarted
daemon_reload: true
enabled: true
listen: "enable vmimage-torrent.service"
- name: Run update-desktop-database
command: update-desktop-database "{{ item }}"
loop:

View file

@ -197,14 +197,7 @@
content: |
allow virbr0
allow virbr1
- name: Deploy rsync.secret
lineinfile:
path: /etc/rsync.secret
line: "{{ rsyncsecret }}"
create: True
mode: '0600'
allow virbr2
- name: Configure macvtap interface
ansible.builtin.copy: