Desplegament amb vagrant
Primer de tot, com canviem de grup, copiem l’arxiu Vagrant file des del terminal amb la comanda scp als integrats del club.
[08:56:46][OVAs][clozano@clozano]-$ scp Vagrantfile ajosemaria@10.24.1.254:/home/ajosemaria/vagrant/
Vagrantfile 100% 1882 376.9KB/s 00:00 Després de copiar el “Vagrantfile”, ens connectem remotament amb el membre de l’equip per SSH amb les claus SSH compartides i eliminem les boxes registrades.
[08:44:23][vagrant][ajosemaria@ajosemaria]-$ vagrant destroy -f
==> ubuntu: VM not created. Moving on...
==> rocky: VM not created. Moving on...
==> debian: VM not created. Moving on...
==> w2k19: VM not created. Moving on...
==> w10: VM not created. Moving on. [08:46:17][vagrant][ajosemaria@ajosemaria]-$ vagrant box remove ubuntuMATE
Removing box 'ubuntuMATE' (v0) with provider 'virtualbox'...
[08:46:23][vagrant][ajosemaria@ajosemaria]-$ vagrant box remove w10-repte-1
Removing box 'w10-repte-1' (v0) with provider 'virtualbox'...
[08:46:30][vagrant][ajosemaria@ajosemaria]-$ vagrant box remove w2k19-repte1
Removing box 'w2k19-repte1' (v0) with provider 'virtualbox'... Fet això, revisem que tenim les boxes necessàries a la nostra subxarxa per afegir-les al Vagrant.
[08:45:19][vagrant][ajosemaria@ajosemaria]-$ ls -lah
total 20G
drwxr-xr-x 3 ajosemaria smx2 4,0K Dec 2 08:44 .
drwxr-x--- 23 ajosemaria smx2 4,0K Dec 2 08:23 ..
-rw-r--r-- 1 ajosemaria smx2 1,1G Nov 5 11:41 rocky.box
-rw-r--r-- 1 ajosemaria smx2 5,6G Dec 2 08:29 ubuntu.box
drwxr-xr-x 4 ajosemaria smx2 4,0K Dec 2 08:44 .vagrant
-rw-r--r-- 1 ajosemaria smx2 1,9K Dec 2 08:19 Vagrantfile
-rw-r--r-- 1 ajosemaria smx2 14G Oct 31 18:23 w10.box Afegim les boxes necessàries per després arrencar-les.
[08:48:41][vagrant][ajosemaria@ajosemaria]-$ vagrant box add --name rocky rocky.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'rocky' (v0) for provider: (amd64)
box: Unpacking necessary files from: file:///home/ajosemaria/vagrant/rocky.box
==> box: Successfully added box 'rocky' (v0) for '(amd64)'!
[08:49:06][vagrant][ajosemaria@ajosemaria]-$ vagrant box add --name w10 w10.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'w10' (v0) for provider: (amd64)
box: Unpacking necessary files from: file:///home/ajosemaria/vagrant/w10.box
==> box: Successfully added box 'w10' (v0) for '(amd64)'!
[08:51:17][vagrant][ajosemaria@ajosemaria]-$ vagrant box add --name ubuntu ubuntu.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu' (v0) for provider: (amd64)
box: Unpacking necessary files from: file:///home/ajosemaria/vagrant/ubuntu.box
==> box: Successfully added box 'ubuntu' (v0) for '(amd64)'! Afegides les boxes, arranquem una per fer la prova.
[08:52:08][vagrant][ajosemaria@ajosemaria]-$ vagrant up ubuntu
Bringing machine 'ubuntu' up with 'virtualbox' provider...
==> ubuntu: Importing base box 'ubuntu'...
==> ubuntu: Matching MAC address for NAT networking...
==> ubuntu: Setting the name of the VM: MV_UBUNTU
==> ubuntu: Clearing any previously set network interfaces...
==> ubuntu: Preparing network interfaces based on configuration...
ubuntu: Adapter 1: nat
ubuntu: Adapter 2: bridged
==> ubuntu: Forwarding ports...
ubuntu: 22 (guest) => 2222 (host) (adapter 1)
==> ubuntu: Running 'pre-boot' VM customizations...
==> ubuntu: Booting VM...
==> ubuntu: Waiting for machine to boot. This may take a few minutes...
ubuntu: SSH address: 127.0.0.1:2222
ubuntu: SSH username: vagrant
ubuntu: SSH auth method: private key
ubuntu:
ubuntu: Vagrant insecure key detected. Vagrant will automatically replace
ubuntu: this with a newly generated keypair for better security.
ubuntu:
ubuntu: Inserting generated public key within guest...
ubuntu: Removing insecure key from the guest if it's present...
ubuntu: Key inserted! Disconnecting and reconnecting using new SSH key...
==> ubuntu: Machine booted and ready!
==> ubuntu: Checking for guest additions in VM...
==> ubuntu: Configuring and enabling network interfaces...
==> ubuntu: Mounting shared folders...
ubuntu: /home/ajosemaria/vagrant => /vagrant Com podem veure, no tenim cap error. Provem d’accedir per Vagrant amb el SSH.
[09:44:12][vagrant][ajosemaria@ajosemaria]-$ vagrant ssh ubuntu
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.0-84-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
Expanded Security Maintenance for Applications is not enabled.
14 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
17 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm
Last login: Tue Dec 2 09:11:23 2025 from 10.0.2.2
vagrant@plantubuntu-VirtualBox:~$ Ara, això amb totes les boxes a cada integrant del grup.