PeterMosmans.virtualbox-guest
Ansible Role: virtualbox-guest
This role installs and sets up the VirtualBox guest additions. It checks if there is an ISO file mounted with the VBoxGuestAdditions. If not, it can download the needed ISO file directly from download.virtualbox.org
.
Requirements
No special requirements, as all needed tools will be installed (and can be removed later). If you do not set the virtualbox_keep variable to true, it will remove the packages used for building after the role runs, leaving your system as it was before.
Required packages include:
- bzip2
- dkms
- gcc
- make
- linux-headers
Role Variables
Here are the available variables and their default settings:
virtualbox_keep: A yes/no option to decide if the required packages should stay on the system. Defaults to no if not set.
virtualbox_iso: The path on the guest where the ISO file is expected. This file will be deleted after the installation is successful.
local_virtualbox_iso: The path on the host where the ISO is located. On Linux systems, it can typically be found at /usr/share/virtualbox/VBoxGuestAdditions.iso
. If set, the role will copy this ISO from the host to the guest.
virtualbox_remove_os_packages: A yes/no option to decide if any previously installed VirtualBox packages should be removed. Defaults to no if not set.
virtualbox_version: The desired version of VirtualBox. If the current version doesn't match, it will try to install the guest additions. If set to auto
, it will automatically find out the VirtualBox version on the host. Default settings can be found in defaults/main.yml
.
virtualbox_version: auto
virtualbox_x11: A yes/no option indicating if the guest additions should be compiled with x11 support. Defaults to no if not set.
Dependencies
None.
Example Playbook
- hosts: all
become: yes
become_method: sudo
roles:
- role: PeterMosmans.virtualbox-guest
This example will install the VirtualBox guest additions and will not keep the build packages on the system if they are no longer needed.
License
GPLv3
Author Information
Created by Peter Mosmans.
Contributions are welcome! Thanks to all current contributors: see [https://github.com/PeterMosmans/ansible-role-virtualbox-guest/graphs/contributors]
Builds and installs VirtualBox guest additions - either from ISO file or downloads the necessary files.
ansible-galaxy install PeterMosmans.virtualbox-guest