diff --git a/vagrant/defaults/main.yml b/vagrant/defaults/main.yml index 630b0cbb..9bbd268c 100644 --- a/vagrant/defaults/main.yml +++ b/vagrant/defaults/main.yml @@ -3,8 +3,9 @@ vagrant_install: False vagrant_package_from_site: False vagrant_site_version: 1.7.4 vagrant_url: 'https://dl.bintray.com/mitchellh/vagrant/vagrant_{{ vagrant_site_version }}_x86_64.deb' +virtualbox_version: 5.0 vagrant_package_list: - 'linux-headers-{{ ansible_kernel }}' - - vagrant - - virtualbox + - 'virtualbox-{{ virtualbox_version }}' + diff --git a/vagrant/tasks/main.yml b/vagrant/tasks/main.yml index 82e6624d..24cf35ba 100644 --- a/vagrant/tasks/main.yml +++ b/vagrant/tasks/main.yml @@ -1,15 +1,26 @@ --- -- name: Install the vagrant packages and requirements - apt: name={{ item }} state={{ pkg_state }} - with_items: vagrant_package_list - tags: vagrant - - name: Get the package from the vagrant site get_url: url='{{ vagrant_url }}' dest=/opt/vagrant_{{ vagrant_site_version }}_x86_64.deb when: vagrant_package_from_site - tags: vagrant + tags: [ 'vagrant', 'virtualbox' ] + +- name: Install the virtualbox repository key + apt_key: url=https://www.virtualbox.org/download/oracle_vbox.asc state=present + when: vagrant_package_from_site + tags: [ 'vagrant', 'virtualbox' ] + +- name: Install the virtualbox repository + apt_repository: repo='deb http://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib' state=present update_cache=yes + when: vagrant_package_from_site + tags: [ 'vagrant', 'virtualbox' ] + +- name: Install the virtualbox package and vagrant requirements + apt: name={{ item }} state={{ pkg_state }} + with_items: vagrant_package_list + tags: [ 'vagrant', 'virtualbox' ] - name: Install the package from the vagrant site apt: deb=/opt/vagrant_{{ vagrant_site_version }}_x86_64.deb when: vagrant_package_from_site - tags: vagrant + tags: [ 'vagrant', 'virtualbox' ] +