Skip to content

Commit fe36ea4

Browse files
author
William Graef
committed
add vbox install
1 parent 6c20338 commit fe36ea4

File tree

4 files changed

+87
-2
lines changed

4 files changed

+87
-2
lines changed

ol/create_instance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@
315315
ansible.builtin.import_playbook: provision_vnc.yml
316316
when: use_vnc
317317

318+
- name: Provision VirtualBox
319+
ansible.builtin.import_playbook: provision_vbox.yml
320+
when: use_vbox
321+
318322
- name: Print instances
319323
hosts: all
320324
become: true

ol/default_vars.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,10 @@ use_haproxy: false
4545
use_nginx: false
4646
use_nfs: false
4747
use_quay_ha: false
48+
49+
use_vbox: false
50+
virtualbox_version: "7.1"
51+
virtualbox_extpack_version: "7.1.2"
52+
ol_iso_version: "9"
53+
ol_update: "4"
54+

ol/provision_vbox.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0.
4+
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
5+
# See LICENSE.TXT for details.
6+
7+
- name: Install VNC Server and GNOME Desktop
8+
hosts: vbox
9+
vars_files:
10+
- default_vars.yml
11+
become: true
12+
13+
tasks:
14+
15+
- name: Install required packages for virtualbox
16+
ansible.builtin.dnf:
17+
name:
18+
- "kernel-uek-devel-{{ ansible_kernel }}"
19+
- gcc
20+
- make
21+
- perl
22+
state: latest
23+
24+
- name: Add virtualbox repo keys
25+
ansible.builtin.rpm_key:
26+
state: present
27+
key: https://www.virtualbox.org/download/oracle_vbox_2016.asc
28+
29+
- name: Add virtualbox repo
30+
ansible.builtin.yum_repository:
31+
name: virtualbox
32+
description: Oracle VirtualBox
33+
baseurl: http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
34+
35+
- name: "Install virtualbox version {{ virtualbox_version }}"
36+
ansible.builtin.dnf:
37+
name: "VirtualBox-{{ virtualbox_version }}"
38+
state: latest
39+
40+
- name: Check if extension pack is already installed
41+
ansible.builtin.shell: "vboxmanage list extpacks"
42+
register: extpack_list
43+
44+
- name: Output installed extpacks
45+
ansible.builtin.debug:
46+
var: extpack_list.stdout
47+
verbosity: 1
48+
49+
- name: Download virtualbox extension pack
50+
ansible.builtin.get_url:
51+
url: 'https://download.virtualbox.org/virtualbox/{{ virtualbox_extpack_version }}/Oracle_VirtualBox_Extension_Pack-{{ virtualbox_extpack_version }}.vbox-extpack'
52+
dest: /tmp/
53+
force: yes
54+
register: download_result
55+
when: 'extpack_list.stdout == "Extension Packs: 0"'
56+
57+
- name: Output download virtualbox extension pack file name
58+
ansible.builtin.debug:
59+
var: download_result.dest
60+
verbosity: 1
61+
62+
- name: Install virtualbox extension pack
63+
ansible.builtin.shell: "echo 'y' | vboxmanage extpack install --replace {{ download_result.dest }}"
64+
when: 'extpack_list.stdout == "Extension Packs: 0"'
65+
66+
- name: Download the Oracle Linux iso file
67+
ansible.builtin.get_url:
68+
url: 'https://yum.oracle.com/ISOS/OracleLinux/OL{{ ol_version }}/u{{ ol_update }}/x86_64/OracleLinux-R{{ ol_version }}-U{{ ol_update }}-x86_64-dvd.iso'
69+
dest: /home/{{ username }}
70+
force: yes
71+
register: download_iso_result
72+
until: "'OK' in download_iso_result.msg"
73+
retries: 5
74+
delay: 10

ol/provision_vnc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl)
55
# See LICENSE.TXT for details.
66

7-
- name: Install Podman and Container Tools
8-
hosts: server
7+
- name: Install VNC Server and GNOME Desktop
8+
hosts: server,vbox
99
vars_files:
1010
- default_vars.yml
1111
become: true

0 commit comments

Comments
 (0)