Skip to content

Commit

Permalink
Switched to shell provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed Dec 17, 2023
1 parent 44d2d13 commit 2aa8693
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 82 deletions.
4 changes: 0 additions & 4 deletions .ansible-lint

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/ansible-lint.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
branches: [main]
paths:
- .github/workflows/release.yml
- playbook.yml
- requirements.yml
- Vagrantfile
schedule:
# Runs automatically on the 27th of every month at 05:30 UTC. This is
Expand Down Expand Up @@ -40,14 +38,6 @@ jobs:
restore-keys: |
${{ runner.os }}-vagrant-
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Set up Ansible
run: pip3 install ansible

- name: Vagrant base box update
run: vagrant box update

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/.vagrant/
/roles/
/package.box
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

:package: **Debian Vagrant box** with **Vagrant** and **VirtualBox** for nested virtualization.

This project uses:

- [dmotte/vagrant-ansiblebox](https://github.com/dmotte/vagrant-ansiblebox) as base box.
- [Oefenweb/ansible-virtualbox](https://github.com/Oefenweb/ansible-virtualbox) to install _VirtualBox_ inside the VM.
- [dmotte/ansible-role-vagrant](https://github.com/dmotte/ansible-role-vagrant) to install _Vagrant_ inside the VM.
This project uses [dmotte/vagrant-ansiblebox](https://github.com/dmotte/vagrant-ansiblebox) as base box.

> :package: This box is also on **Vagrant Cloud** as [`dmotte/vagrantbox`](https://app.vagrantup.com/dmotte/boxes/vagrantbox).
Expand Down
38 changes: 33 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,39 @@ Vagrant.configure("2") do |config|
vb.customize ["modifyvm", :id, "--nested-hw-virt", "on"]
end

config.vm.provision "ansible" do |ansible|
ansible.galaxy_role_file = "requirements.yml"
ansible.playbook = "playbook.yml"
ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python3" }
end
config.vm.provision "shell", inline: <<-SHELL
# From: https://github.com/dmotte/misc/blob/main/scripts/fetch-and-check.sh
fetch_and_check() {
local c s; c="$(curl -fsSL "$1"; echo x)" && \
s="$(echo -n "${c%x}" | sha256sum | cut -d' ' -f1)" && \
if [ "$s" = "$2" ]; then echo -n "${c%x}"
else echo "Checksum verification failed for $1: got $s, expected $2" >&2
return 1; fi
}
codename="$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)"
apt-get update; apt-get install -y curl gnupg linux-headers-generic
fetch_and_check \
'https://www.virtualbox.org/download/oracle_vbox_2016.asc' \
'49e6801d45f6536232c11be6cdb43fa8e0198538d29d1075a7e10165e1fbafe2' | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/virtualbox.gpg
echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/virtualbox.gpg]' \
"https://download.virtualbox.org/virtualbox/debian $codename contrib" | \
tee /etc/apt/sources.list.d/virtualbox.list
apt-get update; apt-get install -y virtualbox-7.0
# Note: a reboot is required before being able to use VirtualBox
fetch_and_check \
'https://apt.releases.hashicorp.com/gpg' \
'cafb01beac341bf2a9ba89793e6dd2468110291adfbb6c62ed11a0cde6c09029' | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/hashicorp.gpg
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/hashicorp.gpg]' \
"https://apt.releases.hashicorp.com $codename main" | \
tee /etc/apt/sources.list.d/hashicorp.list
apt-get update; apt-get install -y vagrant
SHELL

config.ssh.insert_key = false # This is usually recommended for base boxes
end
33 changes: 0 additions & 33 deletions playbook.yml

This file was deleted.

6 changes: 0 additions & 6 deletions requirements.yml

This file was deleted.

0 comments on commit 2aa8693

Please sign in to comment.