feat(libvirt): Add support for libvirt (qemu)
This commit is contained in:
parent
4380bafe28
commit
e248973644
32
Makefile
32
Makefile
@ -8,19 +8,33 @@ up:
|
|||||||
vagrant up; \
|
vagrant up; \
|
||||||
else \
|
else \
|
||||||
echo "No Homelab installation found or missing components, creating..."; \
|
echo "No Homelab installation found or missing components, creating..."; \
|
||||||
sleep 10; \
|
sleep 5; \
|
||||||
$(MAKE) install_vb; \
|
$(MAKE) install; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
down:
|
down:
|
||||||
@echo "Stopping Homelab..."
|
@echo "Stopping Homelab..."
|
||||||
@vagrant halt
|
@vagrant halt
|
||||||
|
|
||||||
|
install:
|
||||||
|
@vagrant plugin list | grep libvirt > /dev/null; \
|
||||||
|
if [ "$$?" -gt 0 ]; then \
|
||||||
|
$(MAKE) install_vb; \
|
||||||
|
else \
|
||||||
|
$(MAKE) install_libvirt; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing k3s backbone configuration...";
|
||||||
|
make ansible;
|
||||||
|
|
||||||
install_vb:
|
install_vb:
|
||||||
@echo "Creating components..."
|
@echo "Creating components using virtualbox..."
|
||||||
@vagrant up
|
@vagrant up --provider=virtualbox
|
||||||
@echo "Installing k3s backbone configuration..."
|
|
||||||
@make ansible
|
install_libvirt:
|
||||||
|
@echo "Creating components using libvirt..."
|
||||||
|
@vagrant up --provider=libvirt
|
||||||
|
|
||||||
|
|
||||||
wg:
|
wg:
|
||||||
@cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ../inventory/lab.yml -i ../inventory/outsider.yml init.yml --extra-vars "enable_setup=false enable_wireguard=true enable_k3s=false"
|
@cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ../inventory/lab.yml -i ../inventory/outsider.yml init.yml --extra-vars "enable_setup=false enable_wireguard=true enable_k3s=false"
|
||||||
@ -39,10 +53,14 @@ destroy:
|
|||||||
@echo "Destroy Homelab installation..."
|
@echo "Destroy Homelab installation..."
|
||||||
@vagrant destroy -f
|
@vagrant destroy -f
|
||||||
|
|
||||||
|
full_reset:
|
||||||
|
$(MAKE) destroy;
|
||||||
|
$(MAKE) install;
|
||||||
|
|
||||||
get_k3s_credentials:
|
get_k3s_credentials:
|
||||||
@echo "Retrieving k3s credentials locally..."
|
@echo "Retrieving k3s credentials locally..."
|
||||||
@vagrant ssh -c "sudo cat /home/creator/.kube/config" hb-wide-1 > ~/.kube/config-halia
|
@vagrant ssh -c "sudo cat /home/creator/.kube/config" hb-wide-1 > ~/.kube/config-halia
|
||||||
@sed -i 's/100.64.*:/192.168.56.101:/g' ~/.kube/config-halia
|
@sed -i 's/127.0.*:/192.168.56.101:/g' ~/.kube/config-halia
|
||||||
@kube-merge
|
@kube-merge
|
||||||
@kubectl get nodes --context halia
|
@kubectl get nodes --context halia
|
||||||
|
|
||||||
|
17
Vagrantfile
vendored
17
Vagrantfile
vendored
@ -8,12 +8,18 @@ Vagrant.configure("2") do |config|
|
|||||||
v.cpus = 2
|
v.cpus = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.vm.provider "libvirt" do |q|
|
||||||
|
q.memory = 2048
|
||||||
|
q.cpus = 2
|
||||||
|
end
|
||||||
|
|
||||||
boxes = [
|
boxes = [
|
||||||
{ :name => "hb-slim-1", :ip => "192.168.56.11"},
|
{ :name => "hb-slim-1", :ip => "192.168.56.11"},
|
||||||
{ :name => "hb-slim-2", :ip => "192.168.56.12"},
|
{ :name => "hb-slim-2", :ip => "192.168.56.12"},
|
||||||
{ :name => "hb-slim-3", :ip => "192.168.56.13"},
|
{ :name => "hb-slim-3", :ip => "192.168.56.13"},
|
||||||
{ :name => "hb-wide-1", :ip => "192.168.56.101", :cpus => 2, :memory => 4096},
|
{ :name => "hb-wide-1", :ip => "192.168.56.101", :cpus => 2, :memory => 4096},
|
||||||
{ :name => "hb-wide-2", :ip => "192.168.56.102", :cpus => 2, :memory => 4096},
|
{ :name => "hb-wide-2", :ip => "192.168.56.102", :cpus => 2, :memory => 4096},
|
||||||
|
{ :name => "hb-wide-3", :ip => "192.168.56.103", :cpus => 2, :memory => 4096},
|
||||||
{ :name => "nas", :ip => "192.168.56.200", :cpus => 2, :memory => 4096, :drive => { name: "extra_disk", size: "30GB" }},
|
{ :name => "nas", :ip => "192.168.56.200", :cpus => 2, :memory => 4096, :drive => { name: "extra_disk", size: "30GB" }},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -24,6 +30,7 @@ Vagrant.configure("2") do |config|
|
|||||||
if !opts[:drive].nil?
|
if !opts[:drive].nil?
|
||||||
box.vm.disk :disk, size: opts[:drive][:size], name: opts[:drive][:name]
|
box.vm.disk :disk, size: opts[:drive][:size], name: opts[:drive][:name]
|
||||||
end
|
end
|
||||||
|
|
||||||
box.vm.provider "virtualbox" do |v|
|
box.vm.provider "virtualbox" do |v|
|
||||||
if !opts[:memory].nil?
|
if !opts[:memory].nil?
|
||||||
v.memory = opts[:memory]
|
v.memory = opts[:memory]
|
||||||
@ -32,6 +39,16 @@ Vagrant.configure("2") do |config|
|
|||||||
v.cpus = opts[:cpus]
|
v.cpus = opts[:cpus]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
box.vm.provider "libvirt" do |q|
|
||||||
|
if !opts[:memory].nil?
|
||||||
|
q.memory = opts[:memory]
|
||||||
|
end
|
||||||
|
if !opts[:cpus].nil?
|
||||||
|
q.cpus = opts[:cpus]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user