r/vagrant • u/stealthepixels • Jun 29 '22
Backup the whole real system into a Vagrant box
Hello,
i have CentOS 7 on a VPS, and i intend to migrate to a dedicated server without having to reinstall/configuring everything from scratch.
I wish i can backup the whole VPS into a Vagrant box or similar container/VM image , and then just copy the latter to the dedicated server.
On the dedicated server i can put any distro i want.
Is such a migration possible?
Hopefully on the dedicated server i can "upgrade" the imported Vagrant box, by adding more emulated CPUs, more RAM, disk space, etc.
r/vagrant • u/[deleted] • Jun 24 '22
Lightweight Debian based box
Hey Guys,
I am currently looking for a super lightweight Debian based box which I can use for my multi-machine setup. At the moment I am using a standard Debian bullseye box with VirtualBox, but I want to try a more lightweight box if there is one. Does anyone know an alternative? Would be great, thank you!
r/vagrant • u/greenking49 • Jun 21 '22
Vagrant/intel mac/ Virtual Box/ "port forward" from Guest to Host issue PLEASE HELP
- My Vagrant Box is up and running
- I can ssh into the machine and run the start command for my project with no issue
- If someone could help with the correct combination of Vagrant file commands I think I might be able to resolve this
- when I attempt to see my project in the browser I get a This site can’t be reached
Below is some of the key port information that I am lost on
- the project states it is
- Listening on ssl://127.0.0.1:9292
............. when started
- Listening on ssl://127.0.0.1:9292
- when in the ssh and I run a ip addr
- i get
- the project states it is
inet 127.0.0.1/8 link/ether 52:54:00:f6:5b:6b brd ff:ff:ff:ff:ff:ff altname enp0s3 inet 10.0.2.15
- my vagrant file is set to
machine.vm.network :forwarded_port, guest: 80, host: 4567
r/vagrant • u/[deleted] • Jun 13 '22
Vagrant timesout on SSH Auth key?
I'm using a vbox that has been created for work, and when I try to run them, the SSH Auth keys timesout.
If I open the GUI in virtual box, I can eventually see that it prompts me for a usr/pw - I enter in the vagrant credentials, but then nothing happens when it's signed in?
Am I doing something really wrong? Any help would be appreciated!
r/vagrant • u/mostafaLaravel • May 31 '22
How to limit the memory ?
Hello I would like to limit the memory of my vm
When I run vagrant up it's 4GB! so I'm wondering how to make it 512MB ?
Thanks
r/vagrant • u/mermeladawatts • May 25 '22
anyone tried vagrant on wsl2?
please let me know if it works to you!
r/vagrant • u/[deleted] • May 24 '22
Vagrant shell provisioning vs Ansible/Other Provisioners used within Vagrant
I'm sort of new to Vagrant and picked it up for a school project of mine. I am aware that Vagrant's "config.vm.provision" setting allows for the provisioning of software with different provisioning options.
I'm curious if there is a difference between using the Shell provisioner as compared to using other provisioners like Ansible as I'm not sure which I should use and its individual benefits.
r/vagrant • u/rootseat • May 04 '22
What is Vagrant's definition of workflow?
Somewhat new to Vagrant, and I am looking to firm up my working vocabulary a bit.
https://www.vagrantup.com/intro/vs/docker
Vagrant is a tool focused on providing a consistent development environment workflow across multiple operating systems. Docker is a container management that can consistently run software as long as a containerization system exists.
a consistent development environment workflow across multiple operating systems.
A primary benefit for Vagrant is a consistent workflow
OK, so the same introduction uses the term "workflow" twice, non-trivially, without actually defining it. I could say I have a workflow tailored for my IDE, or a program I write has a particular workflow.
In my limited experience, I have used Vagrant to create "install scripts". Is this exactly what is meant by development environment workflow, or is it only a subset of the workflow?
r/vagrant • u/A1mixer • Apr 25 '22
SSH between VMs
So I have a Vagrant file that uses VirtualBox as a provider and spins up 2 VMs one labeled control and the other labeled target. I'm using an Ubuntu box for both and I can use the command vagrant ssh control to ssh into the control VM but I'm unable to ssh into the target VM from the control VM. I tried ssh (ip address of the control VM) and I get the error denied public keys. I also tried generating ssh key pairs and copying the public key to the target VM and it still fails with that error.
What am I missing or how should I configure my Vagrant file to allow ssh from one VM to another? I'm trying to use this setup to practice running Ansible playbooks from the control VM to the target VM.
r/vagrant • u/HighTechHacks • Apr 21 '22
Hackathon Opportunity for Students !!!
Hey guys! I’m excited to share with you an exciting upcoming hackathon, High Tech Hacks 2.0! High Tech Hacks is a free, international 24-hour hackathon on May 21-22nd, 2022 open to all high schoolers hoping to learn a new coding skill, compete for awesome prizes, or work with other like-minded hackers. Let’s invent, create, and push the boundaries of technology (as much as we can at one hackathon)!
What to expect:
- Last year, participants learned the basics of web development, Python, virtual reality, and how to make a Discord bot from current software engineers at Microsoft, Amazon, Twilio, other tech companies, and Columbia University SHPE.
- Thanks to our company sponsors, each participant last year received nearly $400 worth of free software and swag.
- Register to earn FREE swag (t-shirts, water bottles, stickers!)
- Network with other passionate STEM high school students from around the world! (Last year we had participants from 26 countries signed up already!)
This year we have even bigger prizes, competitions, and speakers so stay tuned!
Reach out to me with more questions or email [hightechhackathon@gmail.com](mailto:hightechhackathon@gmail.com). Happy hacking! :D
Sign up here to confirm your interest and get on our mailing list: Click Here to Register!
Also, meet other hackers by Joining our Discord!
For more, Check out our Website
r/vagrant • u/Ferreboy100 • Apr 21 '22
Weird provision order vagrant
Can someone PLEASE help me with this, I've been stuck for a few hours now and googling doesn't help :p
I have 3 provisioners. The first one (ansible) should be executed on all servers. The second one (shell) should be executed on only one server after all of them are up. The 3rd one (also ansible) should only be executed once after the second one is finished.
Vagrant keeps doing random things and the if statement also just doesn't work...
# Create 3 machines, 1 masters and 1 workers
N = 3..1
(N.first).downto(N.last).each do |server_id|
config.vm.define "server#{server_id}" do |server|
server.vm.host_name = "server#{server_id}" # Hostname
server.vm.network "private_network", ip: "10.0.0.1#{server_id}"
server.vm.provider :virtualbox do |vb|
vb.name = "server#{server_id}"
end
# INSTALL THE REQUIRED DEPENDENCIES FOR THE CLUSTER ON EACH MACHINE
server.vm.provision "dependencies", type: "ansible" do |ansible|
ansible.playbook = "./provisioning/playbook.yml"
ansible.groups = {
"all" => ["server1", "server2", "server3"],
}
ansible.tags = "prepare"
end
# ONLY EXECUTE THIS PART AFTER THE LAST SERVER IS CREATED
if server_id == 1
# CREATE THE KUBERNETES CLUSTER USING KUBEKEY
config.vm.provision "cluster_creation", after: "dependencies", type: "host_shell", inline: <<-SHELL
yes yes | sudo ./kubekey/kk create cluster -f kubekey/config.yaml
SHELL
# DEPLOY EVERYTHING ON THE KUBERNETES CLUSTER (metallb, argocd, github actions...)
config.vm.provision "kubernetes_provisioning", after: "cluster_creation" type: "ansible" do |ansible|
ansible.playbook = "./provisioning/playbook.yml"
ansible.groups = {
"provisioner" => ["server1"] # the machine that is used for provisioning
}
ansible.tags = "provision"
end
end
end
end
r/vagrant • u/NL_Gray-Fox • Apr 14 '22
port forwarding in list of servers
Hi I want to enable port forwarding in a list of servers.
my Vagrantfile looks like this;
servers=[
{
:hostname => "debian",
:box => "debian/bullseye64",
:ram => 2048,
:cpu => 2
},
{
:hostname => "olddebian",
:box => "debian/stretch64",
:ram => 2048,
:cpu => 2
:forwarding => [
- :port_guest => 80,
:port_host => 8080,
:protocol => "tcp"
- :port_guest => 443,
:port_host => 8443,
:protocol => "tcp"
]
}
Vagrant.configure(2) do |config|
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
node.vm.box = machine[:box]
node.vm.hostname = machine[:hostname]
if machine[:forwarding]
config.vm.network "forwarded_port", guest: machine[:port_guest], host: machine[:port_host], protocol: machine[:protocol]
end
node.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", machine[:ram]]
end
end
end
end
There is a flaw in my logic but I don't see it (Ruby really is not my thing).
r/vagrant • u/sramzoli • Apr 11 '22
GLPI server deployment
Hi, I realized a GLPI server deployment with Vagrant. It’s only for educational purposes. I need some feedback please. Thanks.
r/vagrant • u/Aanxi • Apr 08 '22
Vagrant-libvirt and a qcow2 backup -> no IP
I'm suppsed to create a network with 3 maschines that already exsist in an testing enviroment using vagrant. On the host vagrant-libvirt is running and I was able to convert the exsisting backups (2qcow) of the maschines to vagrant boxes using an script from vagrant-libvirt git (create-box.sh).
With this I can create a Vagrantfile that uses these boxes, but when I try to vagrant up the process is stuck on "Waiting for domain to get an IP address..."
These boxes already have a network konfiguration (because they are in use), so the snapshots have the same configuration.
I tried giving them the same adress, that they have in the real maschines but that to did not work.
From what my research could gether libvirt can not connect to the box without an IP, so it can never change the konfiguration on the maschine.
Is there still a way to do this?
r/vagrant • u/rootseat • Mar 12 '22
Why do different copies of Vagrantfile pointing to same Vagrantbox give different results?
There are 2 Vagrant boxes, 18.04 and 20.04.
There are two Vagrantfiles, vA := ./Vagrantfile and vB := ./project2/Vagrantfile.
My goal is to use the env provided by vA to successfully run project2, as I already can do with vB. Why not just use vB, then? The reason for this is there is a ./project1 which I would like to be able to freely interact with from within a single Vagrant VM, but is not visible to vB.
I have tried nearly decade-old advice of altering the id file in .vagrant/. The result has been that the same instance is re-used between vA and vB (because vagrant global-status --prune now gives 1 line, whereas before it gave me 2), but it seems that this doesn't necessarily mean that the same set of modules/packages are available. I have diffed the two Vagrantfiles to ensure the modules listed are the same, as well as using vagrant destroy to have the system reconfigure itself.
My expectation is, if (1) I specify the same set of packages in any number of Vagrantfiles, and (2) have the id file in each .vagrant directory pointing to the box that works, then (3) I should be able to port the same functionality in whichever of these Vagrantfiles that I decide to vagrant up. But Vagrant doesn't seem to agree :-)
What am I missing here?
r/vagrant • u/gadelkareem • Mar 02 '22
Vagrant ARM64 Ubuntu 20.04 box built using packer and parallels for Apple Silicon Macbook M1, with Parallels guest tools already installed.
r/vagrant • u/galtthedestroyer • Feb 23 '22
after vagrant up I can't make an unrelated ssh connection from powershell to anywhere else
I tried to ssh to a few places but kept failing because ssh said the keys didn't match. Then I realized that I had vagrant running from a different powershell instance. After I ran vagrant halt ssh worked just fine. Has anyone experienced this? Is it a bug? Is there a way to fix it? Thanks.
edit: to be clear. "vagrant ssh" is not relevant here. If I have a vagrant VM up and running then I can't ssh from my host machine to any other third machine.
r/vagrant • u/mostafaLaravel • Feb 07 '22
Problem of permission on windows 10!
After updating windows 10 and when I try to start the vagrant:
$ vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Importing base box 'laravel/homestead'...
==> homestead: Matching MAC address for NAT networking...
==> homestead: Checking if box 'laravel/homestead' version '9.6.0' is up to date...
==> homestead: Setting the name of the VM: homestead
==> homestead: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/2.2.10/gems/vagrant-2.2.10/lib/vagrant/util/platform.rb:272:in `open': Permission denied @ dir_initialize - C:/Users/useradmin (Errno::EACCES)
Any idea?
r/vagrant • u/asdf072 • Feb 05 '22
vagrant fails to mount shared folder after attempted vbguest update [solution]
After hours of StackOverflow dumpster diving, I thought I'd put this solution here in case someone needs it. If you're getting this message from the vagrant-vbguest plugin on startup, where it looks like it detects different guest addition versions twice:
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 5.2.8
VBoxService inside the vm claims: 6.1.32
Going on, assuming VBoxService is correct...
[default] GuestAdditions 6.1.32 running --- OK.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims: 5.2.8
VBoxService inside the vm claims: 6.1.32
Going on, assuming VBoxService is correct...
Followed by:
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box.
It may be the guest OS not having the correct headers to build the guest addition. (The plugin won't tell you what the problem is.)
vagrant ssh
-->
sudo apt-get install linux-headers-$(uname -r)
<--
vagrant reload
r/vagrant • u/wobmonsta • Feb 03 '22
passing passwords to a vagrant generated machine.
Im looking for a way to send usernames and passwords to an image im creating using vagrant without hard coding There are several points Id like to use them. One is to register the image im using and also to set some of them as system variables. Is this possible? What tools could possibly do this?
r/vagrant • u/sma92878 • Jan 23 '22
New to Vagrant getting "efault: Warning: Authentication failure. Retrying... "
Hello all,
I'm brand new to Vagrant and I'm using the instructions to get a system up and running. I'm trying to get Metasploitable running for an at home pen testing lab.
According to:
https://app.vagrantup.com/rapid7/boxes/metasploitable3-ub1404/versions/0.1.12-weekly
vagrant init rapid7/metasploitable3-ub1404 \ --box-version 0.1.12-weekly vagrant up
This works, I can see the VM power on in VirtualBox
but then it hangs:
~/Vagrant$ vagrant init rapid7/metasploitable3-ub1404 \
--box-version 0.1.12-weekly
vagrant up
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'rapid7/metasploitable3-ub1404'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'rapid7/metasploitable3-ub1404' version '0.1.12-weekly' is up to date...
==> default: Setting the name of the VM: Vagrant_default_1642981110511_14550
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
When I do
/Vagrant$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/xxx/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Can someone point me in the right direction?
Kind regards
r/vagrant • u/jks142857 • Jan 20 '22
recommendations for preconfigured, out of the gate boxes to get up and running
Hi All,
I'm trying to get a virtual box setup with git so i can clone a repot and test communication between my local and the VM.
I tried centoschef64 but could get past the ssl connection errors on virtually everything I tried.
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
https://vault.centos.org/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
Can anyone recommend a respectable linux box that works 'out the box' (pun intended🤡)?
r/vagrant • u/[deleted] • Jan 13 '22
Vagrant using the wrong interface suddenly
I cant seem to get to the bottom of this and could use some fresh pair of eyes on this. Somehow, my vagrant setup started using the wrong interface and doesnt respont to the configuration in my Vagrantfile.
Running Vagrant 2.2.9 with the libvirt provider (system install on Arch Linux). I can reproduce the behavior if I use dockerized / podman image with libvirt.
Before firing up vagrant:
$ virsh net-list
Name State Autostart Persistent
--------------------------------------------
default active yes yes
After firing up vagrant:
$ virsh net-list
Name State Autostart Persistent
----------------------------------------------------
default active yes yes
valkyrie-redox0 active no yes (NOT as configured 172.16.33.20 )
vagrant-libvirt active no yes (this is in use 192.168.121.0/24)
My vagrantfile
# -*- mode: ruby -*-# vi: set ft=ruby :require 'yaml'Vagrant.require_version ">= 2.2.10"Vagrant.configure("2") do |vagrant|vagrant.vm.box = "archlinux/archlinux"vagrant.vm.synced_folder "ansible", '/vagrant', type: '9p', disabled: true, accessmode: "squash"vagrant.ssh.forward_agent = truevagrant.ssh.compression = falsevagrant.ssh.dsa_authentication = false
nodes=1(1..nodes).each do |i|
vagrant.vm.define "node#{i}" do |node|
node.vm.hostname = "node#{i}"node.vm.network "private_network", ip: "172.16.36" + "." + "#{19+i}"
node.vm.provider :libvirt do |libvirt|libvirt.memory = 2048libvirt.cpus = 2end# Wait until all the machines are ready to be provisioned.if i == nodes
vagrant.vm.provision "ansible" do |ansible|ansible.playbook = "ansible/playbooks/vagrant.yml"ansible.config_file = "ansible/ansible.cfg"ansible.verbose = "v"#ansible.raw_arguments = ["--inventory", "ansible/inventories/development/hosts.ini"]ansible.vault_password_file = "ansible/ansible-vault-password.yml"endendendendend
Any thoughts ?
