Mi archivo vagabundo:
Vagrant.configure("2") do |config|
config.vm.define "vm1" do |vm1|
vm1.vm.box = "debian/buster64"
vm1.vm.box.hostname = "debian-vm"
vm1.vm.network "private_network", ip: "192.168.15.140"
end
vb1.vm.provider "virtualbox" do |vb1|
vb1.customize ["modifyvm", :id, "--gui", false] #changed
vb1.customize ["modifyvm", :id, "--memory", "4092"] #changed
vb1.customize ["modifyvm", :id, "--cpus", "4"] #changed
vb1.customize ["modifyvm", :id, "--name", "debian-vm"] #changed
end
vm1.vm.provision "shell" do |sh1|
sh1.inline = "sudo apt-get update"
sh1.inline = "sudo apt-get install wget ntpdate net-tools nano"
end
config.vm.define "vm2" do |vm2|
vm2.vm.box = "centos7"
vm2.vm.box.hostname = "centos7-vm"
vm2.vm.network "private_network", ip: "192.168.15.142"
end
vb2.vm.provider "virtualbox" do |vb2|
vb2.customize ["modifyvm", :id, "--gui", false] #changed
vb2.customize ["modifyvm", :id, "--memory", "4092"] #changed
vb2.customize ["modifyvm", :id, "--cpus", "4"] #changed
vb2.customize ["modifyvm", :id, "--name", "debian-vm"] #changed
end
vm2.vm.provision "shell" do |sh2|
sh2.inline = "sudo yum check-update"
sh2.inline = "sudo yum -y install wget ntpdate net-tools nano"
sh2.inline = "curl -fsSL https://get.docker.com/ | sh"
sh2.inline = "sudo systemctl start docker"
sh2.inline = "sudo systemctl status docker"
sh2.inline = "sudo systemctl enable docker"
sh2.inline = "sudo ps -ef | grep dockerd"
end
end
La salida de cmder (terminal) de este Vagranfile es:
C:\Users\Marlon\OneDrive\pipeline (master -> origin)
λ vagrant up
Vagrant failed to initialize at a very early stage:
There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:
C:/Users/Marlon/OneDrive/pipeline/Vagrantfile:15: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
C:/Users/Marlon/OneDrive/pipeline/Vagrantfile:34: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
Respuesta1
error de sintaxis, tSTRING_BEG inesperado, esperando palabra clave_do o '{' o '('
Este es un error de seguimiento porque tiene un error en la línea anterior.
vb.cpus = 4
El argumento 4
debe citarse de la siguiente manera:
vb.cpus = "4"
Respuesta2
Estaba averiguando y descubrí que el lugar donde lo almacené no se estaba sincronizando (OneDrive), luego lo puse en una carpeta estática y ¡lo logré!
Hice algunas correcciones y algunos comandos y puse los trabajos finales aquí.
PD: Acabo de descubrirlo porque Onedrive estaba reclamando con una advertencia y tengo muchos archivos enormes dentro de algunas carpetas.
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "4096"
vb.cpus = "4"
end
config.vm.define "vm1" do |vm1|
vm1.vm.box = "centos/7"
vm1.vm.network "public_network", bridge: "en1: Realtek PCIe GBE Family Controller"
vm1.vm.network "public_network", ip: "192.168.15.140"
vm1.vm.hostname = "centos-vm"
vm1.vm.provision "shell", inline: <<-SHELL
sudo yum update
sudo yum -y install wget ntpdate net-tools nano
sudo curl -fsSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo systemctl status docker
sudo systemctl enable docker
sudo ps -ef | grep dockerd
SHELL
end
config.vm.define "vm2" do |vm2|
vm2.vm.box = "debian/buster64"
vm2.vm.network "public_network", bridge: "en1: Realtek PCIe GBE Family Controller"
vm2.vm.network "public_network", ip: "192.168.15.142"
vm2.vm.hostname = "debian-vm"
vm2.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install wget ntpdate net-tools nano
SHELL
end
end