-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathVagrantfile.fedora
72 lines (63 loc) · 2.14 KB
/
Vagrantfile.fedora
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# VAGRANT_VAGRANTFILE=Vagrantfile.fedora vagrant up
# vagrant ssh
# sudo ausearch -m avc -ts recent | audit2allow -M snap
# sudo semodule -i snap.pp
# sudo reboot
$script = <<-'SCRIPT'
dnf install -y snapd git ansible kernel-modules kernel-modules-extra openssl grubby
dnf install -y kernel-modules-$(uname -r) kernel-modules-extra-$(uname -r)
grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
ln -s /var/lib/snapd/snap /snap
cat /home/vagrant/selinux-lxd.log | audit2allow -M snap
semodule -i snap.pp
setenforce 0
systemctl start snapd
snap install lxd
gpasswd -a vagrant lxd
cd /home/vagrant/
git clone https://github.com/ihanick/anydbver.git
cat >/home/vagrant/anydbver/.anydbver <<EOF
PROVIDER=lxd
LXD_PROFILE=vagrant
K3S_FLANNEL_BACKEND=host-gw
EOF
chown vagrant:vagrant -R /home/vagrant/anydbver
mkdir /home/vagrant/lxc
lxc storage create vagrant dir source=/home/vagrant/lxc
lxc profile create vagrant
lxc profile device add vagrant root disk type=disk pool=vagrant path=/
lxc network create lxdbr0
lxc profile device add vagrant eth0 nic name=eth0 network=lxdbr0 type=nic
echo 'export LXD_PROFILE=vagrant' >> /home/vagrant/.bashrc
echo 'export K3S_FLANNEL_BACKEND=host-gw' >> /home/vagrant/.bashrc
sudo -u vagrant bash -c 'export HOME=/home/vagrant;cd /home/vagrant/anydbver;./anydbver update'
cat > /etc/sysctl.d/50-k3s.conf <<EOF
vm.overcommit_memory = 1
vm.overcommit_ratio = 10000
kernel.panic = 10
kernel.panic_on_oops = 1
EOF
sysctl -p /etc/sysctl.d/50-k3s.conf
cat > /etc/modules-load.d/k3s.conf <<EOF
br_netfilter
overlay
EOF
modprobe br_netfilter
modprobe overlay
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "fedora/34-cloud-base"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.provision "file", source: "selinux-lxd.log", destination: "/home/vagrant/selinux-lxd.log"
config.vm.provision "shell", inline: $script
config.vm.provision :shell do |shell|
shell.privileged = true
shell.inline = 'echo rebooting'
shell.reboot = true
end
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]
v.memory = 4096
v.cpus = 2
end
end