This is an old revision of the document!
Table of Contents
Step 1 - Set up the Host
You will need to set up a large-ish Ubuntu system. This will be home to the Oracle VirtualBox virtual machines (VM's). You can use any Ubuntu system, but you get points for using a NUC. This system will also be the Ansible controller for this lab.
Install Ubuntu 22.04 Desktop
The first step is to install Ubuntu 22.04 Desktop on the host system. It's a good idea to use a “minimal installation” of Ubuntu for this Lab. If you need help with this step, see the tutorial below.
Update and Install Packages
Once installation is complete, follow best practice to upgrade software packages on the system. Open Terminal and enter the commands below.
sudo apt update sudo apt upgrade -y
Next we will add the ppa:ansible repository and install a number of packages.
sudo apt-add-repository ppa:ansible/ansible sudo apt update sudo apt install openssh-server vim ansible p7zip xorriso ansible python3-passlib -y
You should now be able to ssh to your host.
Configure the ansible User and Generate Keys
- Create the user ansible and give sudo permission (and enter a password for the user when prompted)
sudo useradd -m -s /bin/bash ansible sudo usermod -aG sudo ansible sudo passwd ansible
- Test the new user
- From your regular login switch to the
ansible
usersu - ansible
- Enter the password
sudo uptime
- exit
- Test connecting to your host via SSH with user
ansible
- For the rest of the lab, we will be logged in as the
ansible
user
- Create Keys for Ansible Management
- Ensure you are logged as the user
ansible
ssh-keygen -o
- Do not enter a passphrase
- View the public key and save it for a later step
cat ~/.ssh/id_rsa.pub
- It will look like this:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDKwEYxgppj+um+/W8LLxRpwZ2887IJirfJjFBkE30UeCZ0D1JS2RTMn4QEK1EAphByGxnmCruTL36aLMTO0FNH4IW+017/7wNY4JjRzRssZSMqmdjH4nhYV22JDIWh428p93FLsgqM+ud0Mj06KgJfa4BQtSvnR/p/4AXYzFTwzE+kyussIiOi+uT20AXNEIxk4ps39xhLGc6XNFo1xhtGvTZ9+Jx7AanVht090HuRuxNmOTd260mbeBJUKRF57d9tzZ68YRQiokIunkNF2skfJOZEUaIOWUoGGIWPMlEUEC0RhyW+7Ljmp7RbIOZ45CV0MYZEpKx4KQ61/CoMY4wKBCM90SwxJQwM3CZCseqcVnpFYKpFd6dnn0v0XsmINCU+y1RXYLfsOHEhLTm5WK9ERi5yr/1OjKkId+xZrf7D/v2soQdHsc82d+otbTDXzHYPduc2DfstJg5QFCECNrsEPRishAh2Lm2GJ3h0Pj20loyYeKWlUJpbLjd5A5Mnk9E= ansible@labbox
Install Oracle VirtualBox Using Ansible
NOTE There are many references out there if you don't want to use Ansible to install VirtualBox (e.g., https://linuxconfig.org/install-virtualbox-on-ubuntu-22-04-jammy-jellyfish-linux)
Run the following playbook to install VirtualBox.
- install-virtualbox.yml
--- - hosts: localhost connection: local become: true tasks: - name: Add Oracle apt key apt_key: url: https://www.virtualbox.org/download/oracle_vbox_2016.asc state: present - name: Add Virtualbox repo apt_repository: repo: "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib" state: present - name: Install Virtualbox apt: pkg: - virtualbox state: present update_cache: true - name: Ensure vboxdrv kernel module is loaded (optional) modprobe: name: vboxdrv state: present
Run as
ansible-playbook install-virtualbox.yml --ask-become-pass
Enter the password for the user ansible
when prompted.
Restart the Host
Run sudo reboot
and wait for the host to reboot.
Next Step
Continue to Step 2 - Deploy the VMs
Or back to Start