mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-02-26 11:44:44 +01:00
test(vagrant): add Vagrantfile to use the tests VM.
This commit is contained in:
parent
b1a9a1cb5a
commit
398b22bd96
2 changed files with 85 additions and 0 deletions
57
tests/Vagrantfile
vendored
Normal file
57
tests/Vagrantfile
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
# -*- mode: ruby -*-
|
||||
# apparmor.d - Full set of apparmor profiles
|
||||
# Copyright (C) 2023 Alexandre Pujol <alexandre@pujol.io>
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
require 'yaml'
|
||||
|
||||
machines = YAML.load_file(File.join(File.dirname(__FILE__), 'boxes.yml'))
|
||||
|
||||
Vagrant.require_version '>= 2.0.0'
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.ssh.keys_only = true
|
||||
config.ssh.insert_key = false
|
||||
config.ssh.private_key_path = [ '~/.ssh/id_ed25519' ]
|
||||
config.ssh.username = 'user'
|
||||
|
||||
machines['boxes'].each do |instance|
|
||||
|
||||
# Configure the VMs per details in boxes.yml
|
||||
config.vm.define instance['name'] do |srv|
|
||||
srv.vm.box = instance['box']
|
||||
srv.vm.box_check_update = false
|
||||
srv.vm.post_up_message = instance.to_yaml
|
||||
srv.vm.synced_folder '../', '/home/user/Projects/apparmor.d', type: 'virtiofs'
|
||||
|
||||
# Configure Libvirt provider
|
||||
srv.vm.provider 'libvirt' do |libvirt|
|
||||
libvirt.driver = 'kvm'
|
||||
libvirt.connect_via_ssh = false
|
||||
libvirt.storage_pool_name = 'default'
|
||||
libvirt.memory = instance['ram']
|
||||
libvirt.cpus = instance['cpu']
|
||||
libvirt.cpu_mode = 'host-passthrough'
|
||||
libvirt.machine_type = 'q35'
|
||||
libvirt.video_type = 'virtio'
|
||||
libvirt.graphics_type = 'spice'
|
||||
libvirt.sound_type = 'ich9'
|
||||
libvirt.tpm_model = 'tpm-crb'
|
||||
libvirt.tpm_type = 'emulator'
|
||||
libvirt.tpm_version = '2.0'
|
||||
libvirt.random model: 'random'
|
||||
libvirt.memorybacking 'source', type: 'memfd'
|
||||
libvirt.memorybacking 'access', mode: 'shared'
|
||||
libvirt.channel type: 'unix', target_name: 'org.qemu.guest_agent.0', target_type: 'virtio'
|
||||
(1..2).each do
|
||||
libvirt.redirdev :type => "spicevmc"
|
||||
end
|
||||
if instance['uefi']
|
||||
libvirt.loader = '/usr/share/edk2-ovmf/x64/OVMF_CODE.fd'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
28
tests/boxes.yml
Normal file
28
tests/boxes.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
|
||||
boxes:
|
||||
|
||||
- name: arch-gnome
|
||||
box: aa-archlinux-gnome
|
||||
uefi: false
|
||||
ram: '6144'
|
||||
cpu: '6'
|
||||
|
||||
- name: arch-kde
|
||||
box: aa-archlinux-kde
|
||||
uefi: false
|
||||
ram: '6144'
|
||||
cpu: '6'
|
||||
|
||||
- name: ubuntu-server
|
||||
box: aa-ubuntu-server
|
||||
uefi: true
|
||||
ram: '6144'
|
||||
cpu: '6'
|
||||
|
||||
- name: opensuse-kde
|
||||
box: aa-opensuse-kde
|
||||
uefi: true
|
||||
ram: '6144'
|
||||
cpu: '6'
|
||||
|
Loading…
Add table
Reference in a new issue