SÍNTESI 25 | SAIA

SISTEMA DE DESPLEGAMENT DE MÀQUINES

El nostre sistema que utilitzarem per desplegar les màquines es amb el VagrantFile,

primer de tot per crear la MV utilitzarem el –provision ja que així totes les configuracions extres que l’hem afegit al vagrantfile es guarden i un cop ja s’ha creat la MV deixarem d’utilitzar el –provision a l’hora d’aixecar-la

EL NOSTRE VAGRANTFILE ACTUAL ES EL SEGÜENT

Vagrant.configure(“2”) do |config|

  config.vm.define “server1” do |server1|

server1.vm.box = “debian”

server1.vm.network “private_network”,

                     ip: “10.0.10.130”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red5”

server1.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

server1.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “server2” do |server2|

server2.vm.box = “debian”

server2.vm.network “private_network”,

                     ip: “10.0.10.131”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red6”

server2.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

server2.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “server3” do |server3|

server3.vm.box = “debian”

server3.vm.network “private_network”,

                     ip: “10.0.10.132”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red7”

server3.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

server3.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “backup1” do |backup1|

backup1.vm.box = “debian”

backup1.vm.network “private_network”,

                     ip: “10.0.10.133”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red8”

backup1.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

backup1.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “backup2” do |backup2|

backup2.vm.box = “debian”

backup2.vm.network “private_network”,

                     ip: “10.0.10.134”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red9”

backup2.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

backup2.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “backup3” do |backup3|

backup3.vm.box = “debian”

backup3.vm.network “private_network”,

                     ip: “10.0.10.135”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.143”,

                     virtualbox__intnet: “red10”

backup3.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

backup3.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  # Nuevos servidores

  config.vm.define “server4” do |server4|

server4.vm.box = “debian”

server4.vm.network “private_network”,

                     ip: “10.0.10.146”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.159”,

                     virtualbox__intnet: “red11”

server4.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

server4.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “backup4” do |backup4|

backup4.vm.box = “debian”

backup4.vm.network “private_network”,

                     ip: “10.0.10.147”,

                     netmask: “255.255.255.240”,

                     gateway: “10.0.10.159”,

                     virtualbox__intnet: “red12”

backup4.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

backup4.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “client1” do |client1|

client1.vm.box = “debian”

client1.vm.network “private_network”,

                     ip: “10.0.10.2”,

                     netmask: “255.255.255.192”,

                     gateway: “10.0.10.63”,

                     virtualbox__intnet: “red1”

client1.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

client1.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “client2” do |client2|

client2.vm.box = “debian”

client2.vm.network “private_network”,

                     ip: “10.0.10.3”,

                     netmask: “255.255.255.192”,

                     gateway: “10.0.10.63”,

                     virtualbox__intnet: “red2”

client2.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

client2.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

  config.vm.define “client3” do |client3|

client3.vm.box = “debian”

client3.vm.network “private_network”,

                     ip: “10.0.10.66”,

                     netmask: “255.255.255.192”,

                     gateway: “10.0.10.128”,

                     virtualbox__intnet: “red3”

client3.vm.provider “virtualbox” do |vb|

   vb.gui = false

   vb.memory = “512”

end

client3.vm.provision “shell”, inline: <<-SHELL

   sudo apt-get update -y && sudo apt-get upgrade -y

   sudo apt-get install -y xfce4 xfce4-goodies lightdm

   sudo systemctl set-default graphical.target  # Configura el arranque en modo gráfico

   echo “exec startxfce4” >> ~/.xinitrc  # Inicia XFCE4 al iniciar sesión

SHELL

  end

end

Leave a Comment