Skip to content

Instantly share code, notes, and snippets.

@gpkvt
Last active April 25, 2022 13:09
Show Gist options
  • Save gpkvt/b276223ad5c923023aaa to your computer and use it in GitHub Desktop.
Save gpkvt/b276223ad5c923023aaa to your computer and use it in GitHub Desktop.
SaltStack: Install VirtualBox with ExtensionPack
# This state installs VirtualBox with Extpack
#
# To reinstall the extpack simply delete /srv/*.vbox-extpack
# To update the extpack it's important to keep the original download name otherwise install will fail
{% set extpack = 'Oracle_VM_VirtualBox_Extension_Pack-4.3.10.vbox-extpack' %}
vbox_repo:
pkgrepo.managed:
- name: deb http://download.virtualbox.org/virtualbox/debian wheezy contrib non-free
- key_url: http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
- consolidate: True
vbox_apt_update:
cmd.wait:
- name: apt-get update
- watch:
- pkgrepo: vbox_repo
virtualbox-4.3:
pkg.installed:
- require:
- pkgrepo: vbox_repo
download_virtualbox_extpack:
cmd.run:
- name: wget http://download.virtualbox.org/virtualbox/4.3.10/{{ extpack }} -O /srv/{{ extpack }}
- unless: test -f /srv/{{ extpack }}
install_virtualbox_extpack:
cmd.wait:
- name: VBoxManage extpack install /srv/{{ extpack }}
- watch:
- cmd: download_virtualbox_extpack
/etc/default/virtualbox:
file.managed:
- source: salt://vbox/virtualbox_default
- user: root
- group: root
- mode: 644
/var/log/virtualbox.log:
file.managed:
- user: root
- group: vboxusers
- mode: 664
# createhome must be true, otherwise the vboxwebsrv refuses to start
vbox:
user.present:
- groups:
- vboxusers
- createhome: True
- shell: /bin/false
- password: hash_CHANGE_ME
- enforce_passwrd: True
vboxweb-service:
service:
- running
- enable: True
- watch:
- file: /etc/default/virtualbox
VBOXWEB_USER=vbox
VBOXWEB_HOST=10.0.0.1
VBOXWEB_PORT=18083
VBOXWEB_TIMEOUT=300
VBOXWEB_CHECK_INTERVAL=5
VBOXWEB_THREADS=100
VBOXWEB_KEEPALIVE=100
VBOXWEB_LOGFILE=/var/log/virtualbox.log
INSTALL_DIR=/usr/lib/virtualbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment