{"version":"1.0","provider_name":"Ana Borrego Toledo","provider_url":"https:\/\/aborrego.inscastellbisbal.net\/en","author_name":"aborrego","author_url":"https:\/\/aborrego.inscastellbisbal.net\/en\/author\/aborrego\/","title":"Desplegament amb vagrant - Ana Borrego Toledo","type":"rich","width":600,"height":338,"html":"<blockquote class=\"wp-embedded-content\" data-secret=\"OiSvAhq0Tl\"><a href=\"https:\/\/aborrego.inscastellbisbal.net\/en\/2025\/12\/04\/desplegament-amb-vagrant\/\">Desplegament amb vagrant<\/a><\/blockquote><iframe sandbox=\"allow-scripts\" security=\"restricted\" src=\"https:\/\/aborrego.inscastellbisbal.net\/en\/2025\/12\/04\/desplegament-amb-vagrant\/embed\/#?secret=OiSvAhq0Tl\" width=\"600\" height=\"338\" title=\"&#8220;Desplegament amb vagrant&#8221; &#8212; Ana Borrego Toledo\" data-secret=\"OiSvAhq0Tl\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" class=\"wp-embedded-content\"><\/iframe><script>\n\/*! This file is auto-generated *\/\n!function(d,l){\"use strict\";l.querySelector&&d.addEventListener&&\"undefined\"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!\/[^a-zA-Z0-9]\/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret=\"'+t.secret+'\"]'),o=l.querySelectorAll('blockquote[data-secret=\"'+t.secret+'\"]'),c=new RegExp(\"^https?:$\",\"i\"),i=0;i<o.length;i++)o[i].style.display=\"none\";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute(\"style\"),\"height\"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):\"link\"===t.message&&(r=new URL(s.getAttribute(\"src\")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener(\"message\",d.wp.receiveEmbedMessage,!1),l.addEventListener(\"DOMContentLoaded\",function(){for(var e,t,s=l.querySelectorAll(\"iframe.wp-embedded-content\"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute(\"data-secret\"))||(t=Math.random().toString(36).substring(2,12),e.src+=\"#?secret=\"+t,e.setAttribute(\"data-secret\",t)),e.contentWindow.postMessage({message:\"ready\",secret:t},\"*\")},!1)))}(window,document);\n\/\/# sourceURL=https:\/\/aborrego.inscastellbisbal.net\/wp-includes\/js\/wp-embed.min.js\n<\/script>","description":"Desplegament amb vagarant Tornar al repte 2.2 Per qu\u00e8 triar Vagrant Eina \/ M\u00e8tode Nom\u00e9s VirtualBox\/VMware manual Qu\u00e8 fa Crear i configurar VMs a m\u00e0 Avantatges Control total Problemes per a aquest repte Molt temps, no reproducible, cada persona ho fa diferent Per qu\u00e8 NO l\u2019he triat No \u00e9s portable ni repetible Eina \/ M\u00e8tode Docker Qu\u00e8 fa Contenidors lleugers Avantatges Molt r\u00e0pid i lleuger Problemes per a aquest repte No \u00e9s una m\u00e0quina completa \u2192 no puc provar diferents SO ni instal\u00b7lar serveis que necessitin un kernel diferent Per qu\u00e8 NO l\u2019he triat No cobreix el 100 % dels casos del repte Eina \/ M\u00e8tode Ansible (nom\u00e9s configuraci\u00f3) Qu\u00e8 fa Configura m\u00e0quines ja existents Avantatges Excel\u00b7lent per configuraci\u00f3 Problemes per a aquest repte No crea ni gestiona les VMs, he de fer-ho a m\u00e0 abans Per qu\u00e8 NO l\u2019he triat Soluci\u00f3 a mitges Eina \/ M\u00e8tode Vagrant Qu\u00e8 fa Crea i configura VMs autom\u00e0ticament Avantatges \u2192 Un sol fitxer (Vagrantfile) \u2192 Funciona igual a Windows, Mac i Linux \u2192 vagrant up i ja est\u00e0 \u2192 Pots usar VirtualBox, VMware, Hyper-V o fins i tot Problemes per a aquest repte Cap desavantatge important per aquest \u00fas Per qu\u00e8 NO l\u2019he triat \u00c9s la millor opci\u00f3 Motius concrets pels quals Vagrant \u00e9s la millor elecci\u00f3 aqu\u00ed Portabilitat total \u2013 Tothom de l\u2019equip (o el professor) nom\u00e9s ha de fer vagrant up i t\u00e9 exactament el mateix entorn, independentment del seu sistema operatiu. Reprodu\u00efbilitat 100 % \u2013 Tot queda escrit en un sol fitxer Vagrantfile (box, mem\u00f2ria, ports, carpetes compartides, provisioning amb shell\/Ansible\/Puppet\u2026). Facilitat extrema \u2013 En 10-15 l\u00ednies de codi tinc una VM amb Ubuntu 24.04, 2 GB RAM, port 8080 redirigit, carpeta del projecte sincronitzada i paquets instal\u00b7lats autom\u00e0ticament.. Desplegament Vagrant Estructura de carpetes: Dins de la carpeta desplegament_vagrant2 hi ha un Vagrantfile, configurat amb les boxes que necessitem: # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(&quot;2&quot;) do |config| # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 # Windows 10 # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 config.vm.define &quot;win10&quot; do |win| win.vm.box = &quot;windows10-local&quot; win.vm.hostname = &quot;win10-local&quot; # Bridge: tria tu la interf&iacute;cie de xarxa (Wi-Fi o cable) win.vm.network &quot;public_network&quot;, bridge: &quot;enp3s0&quot; # Linux # win.vm.network &quot;public_network&quot;, bridge: &quot;Wi-Fi&quot; # Windows (nom exacte de la teva targeta) # win.vm.network &quot;public_network&quot;, bridge: &quot;en0: Wi-Fi&quot; # macOS (normalment en0 o en1) win.vm.provider &quot;virtualbox&quot; do |vb| vb.name = &quot;Windows10-Local-Bridge&quot; vb.memory = 8192 # 8 GB RAM (ajusta si cal) vb.cpus = 4 vb.gui = true # posa false si la vols headless vb.customize [&quot;modifyvm&quot;, :id, &quot;--vram&quot;, &quot;128&quot;] vb.customize [&quot;modifyvm&quot;, :id, &quot;--clipboard&quot;, &quot;bidirectional&quot;] vb.customize [&quot;modifyvm&quot;, :id, &quot;--draganddrop&quot;, &quot;bidirectional&quot;] end end # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 # Ubuntu # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 config.vm.define &quot;ubuntu&quot;, primary: true do |ub| ub.vm.box = &quot;ubuntu-local&quot; ub.vm.hostname = &quot;ubuntu-local&quot; ub.vm.network &quot;public_network&quot;, bridge: &quot;enp3s0&quot; # canvia pel teu adaptador ub.vm.provider &quot;virtualbox&quot; do |vb| vb.name = &quot;Ubuntu-Local-Bridge&quot; vb.memory = 4096 vb.cpus = 2 vb.gui = true end end # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 # Debian # \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 config.vm.define &quot;debian&quot; do |deb| deb.vm.box = &quot;debian-local&quot; deb.vm.hostname = &quot;debian-local&quot; deb.vm.network &quot;public_network&quot;, bridge: &quot;enp3s0&quot; # canvia pel teu adaptador deb.vm.provider &quot;virtualbox&quot; do |vb| vb.name = &quot;Debian-Local-Bridge&quot; vb.memory = 2048 vb.cpus = 2 vb.gui = true end end end Si fem vagrant up &#8220;nom_box&#8221; la m\u00e0quina es crea.","thumbnail_url":"https:\/\/aborrego.inscastellbisbal.net\/wp-content\/uploads\/2025\/12\/Selection_020.png","thumbnail_width":601,"thumbnail_height":73}