local.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ---
  2. - hosts: localhost
  3. connection: local
  4. become: true
  5. tasks:
  6. - name: Add an Apt signing key, uses whichever key is at the URL
  7. ansible.builtin.apt_key:
  8. url: https://apt.releases.hashicorp.com/gpg
  9. state: present
  10. - name: Add an Apt signing key, uses whichever key is at the URL
  11. ansible.builtin.apt_key:
  12. url: https://www.virtualbox.org/download/oracle_vbox_2016.asc
  13. state: present
  14. - name: Add an Apt signing key, uses whichever key is at the URL
  15. ansible.builtin.apt_key:
  16. url: https://www.virtualbox.org/download/oracle_vbox.asc
  17. state: present
  18. - name: Add specified repository into sources list using specified filename
  19. ansible.builtin.apt_repository:
  20. repo: deb [arch=amd64] https://apt.releases.hashicorp.com {{ ansible_distribution_release | lower }} main
  21. state: present
  22. filename: vagrant
  23. - name: Add specified repository into sources list using specified filename
  24. ansible.builtin.apt_repository:
  25. repo: deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release | lower }} contrib
  26. state: present
  27. filename: vagrant
  28. - name: install packages
  29. package:
  30. name:
  31. - vagrant
  32. - virtualbox
  33. - name: Check if extension pack is already installed
  34. shell: "VBoxManage list extpacks"
  35. register: extpack_list
  36. - name: Output installed extpacks
  37. debug:
  38. var: extpack_list.stdout
  39. - name: Download VirtualBox extension pack
  40. get_url:
  41. url: "https://download.virtualbox.org/virtualbox/6.1.26/Oracle_VM_VirtualBox_Extension_Pack-6.1.26.vbox-extpack"
  42. dest: /tmp/
  43. force: yes
  44. register: download_result
  45. #when: 'extpack_list.stdout == "Extension Packs: 1*"'
  46. - name: Output downloaded VirtualBox extension pack file name
  47. debug:
  48. var: download_result.dest
  49. verbosity: 1
  50. - name: Install VirtualBox extension pack
  51. shell: "echo 'y' | VBoxManage extpack install --replace {{ download_result.dest }} --accept-license=33d7284dc4a0ece381196fda3cfe2ed0e1e8e7ed7f27b9a9ebc4ee22e24bd23c"
  52. #when: 'extpack_list.stdout == "Extension Packs: 0"'