ansible-hacklab-desktop/roles/virtualbox/tasks/debian.yml

45 lines
1.5 KiB
YAML
Raw Normal View History

2018-06-02 22:03:27 +00:00
- name: VirtualBox APT key
apt_key:
id: 2980AECF
url: https://www.virtualbox.org/download/oracle_vbox_2016.asc
state: present
- name: VirtualBox APT repo
apt_repository:
filename: virtualbox
repo: deb http://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib
state: present
- name: VirtualBox facts
virtualbox_facts:
- name: Remove old versions of VirtualBox
shell: |
apt-mark unhold {{ virtualbox_remove_packages|join(" ") }} || true
DEBIAN_FRONTEND=noninteractive apt-get remove -y --ignore-hold {{ virtualbox_remove_packages|join(" ") }}
when: virtualbox_release is defined and virtualbox_release|string != virtualbox_install_release|string
- name: Install or upgrade VirtualBox
shell: |
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --ignore-hold virtualbox-{{ virtualbox_install_release }}
ignore_errors: yes
- name: Prevent automatic upgrades to VirtualBox
dpkg_selections:
name: virtualbox-{{ virtualbox_install_release }}
selection: hold
- name: VirtualBox facts
virtualbox_facts:
- name: Install VirtualBox extension pack
when: virtualbox_version != virtualbox_extpack_version
shell: |
set -e
url=http://download.virtualbox.org/virtualbox/{{ virtualbox_version }}/Oracle_VM_VirtualBox_Extension_Pack-{{ virtualbox_version }}-{{ virtualbox_build }}.vbox-extpack
tmp=$(mktemp -d)
cd $tmp
wget $url
echo y | vboxmanage extpack install --replace *.vbox-extpack
rm -rf $tmp