---
- name: Ensure that directory for extensions exists
  file:
    path: "{{ _virtualbox.extensions_dir }}"
    state: directory
    recurse: yes

- name: Compute VirtualBox version
  # "VBoxManage -v" is not satisfiable since it output something like "5.1.22r115126".
  shell: "VBoxManage --help | head -n 1 | awk '{print $NF}'"
  register: virtualbox_version

- include: extension.yml
  args:
    virtualbox_extension: "{{ item | replace('<VERSION>', virtualbox_version.stdout) }}"
  with_items: "{{ virtualbox.extensions }}"

#- name: Check host betwork
#  shell: cat /proc/net/dev | grep vboxnet0 | cut -c1-8
#  register: vboxnet0
#
#- include: network.yml
#  when: "'vboxnet0' != vboxnet0.stdout"

---
- name: Ensure that directory for extensions exists
  file:
    path: "{{ _virtualbox.extensions_dir }}"
    state: directory
    recurse: yes

- name: Compute VirtualBox version
  # "VBoxManage -v" is not satisfiable since it output something like "5.1.22r115126".
  shell: "VBoxManage --help | head -n 1 | awk '{print $NF}'"
  register: virtualbox_version

- include: extension.yml
  args:
    virtualbox_extension: "{{ item | replace('<VERSION>', virtualbox_version.stdout) }}"
  with_items: "{{ virtualbox.extensions }}"

#- name: Check host betwork
#  shell: cat /proc/net/dev | grep vboxnet0 | cut -c1-8
#  register: vboxnet0
#
#- include: network.yml
#  when: "'vboxnet0' != vboxnet0.stdout"

- name: Enabled VirtualBox Driver service
  service:
    name: vboxdrv
    state: restarted
    enabled: yes

Add starting and enabling on boot of "vboxdrv" service
[CIKit][Matrix] Add starting and enabling on boot of "vboxdrv" service
