text: - name: download VBox (debian)
    get_url:
      validate_certs: "{{ validate_certs }}"
      url: http://download.virtualbox.org/virtualbox/{{ vbox_major_version }}/virtualbox-{{ vbox_version_ubuntu_dist_version[ansible_distribution_release] }}_amd64.deb
      dest: /tmp/virtualbox-{{ vbox_major_version }}.deb
      force: no
  
  - name: check for installed vbox (ubuntu)
    shell: VBoxManage --version
    register: vbox_installed_version
    ignore_errors: yes
  
  - name: stop vbox service if it is running (ubuntu)
    service: name=vbox state=stopped
    when: not (vbox_installed_version.stdout | match('.*{{vbox_package_version}}.*'))
    ignore_errors: yes
  
  - name: uninstall VBox (ubuntu)
    apt: name='virtualbox-*' state=absent
    when: not (vbox_installed_version.stdout | match('.*{{vbox_package_version}}.*'))
  
  - name: install VBox (debian)
    apt: deb=/tmp/virtualbox-{{ vbox_major_version }}.deb state=present
  
  - name: install VBox dkms (debian)
    apt: name=dkms state=latest
  
  - name: copy systemd units for virtualbox-server
    template: src=vbox.service.j2 dest=/etc/systemd/system/vbox.service
  
  - name: enable vbox to be started on boot-up and start it as well
    service: name=vbox state=started enabled=yes
  
  - name: download vagrant (debian)
    get_url:
      validate_certs: "{{ validate_certs }}"
      url: https://releases.hashicorp.com/vagrant/{{ vagrant_version }}/vagrant_{{ vagrant_version }}_x86_64.deb
      dest: /tmp/vagrant_{{ vagrant_version }}.deb
      force: no
  
  - name: install vagrant (debian)
    apt: deb=/tmp/vagrant_{{ vagrant_version }}.deb state=present
  