Saturday, April 18, 2020

windows image create

vagrantfile to create box





# -*- mode: ruby -*- 
# vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. 
Vagrant.configure(2) do |config| 
    config.vm.guest = :windows 
    config.vm.communicator = "winrm" 
    config.vm.boot_timeout = 600 
    config.vm.graceful_halt_timeout = 600 
    config.vm.network "forwarded_port", guest: 80, host: 8080 
    config.vm.network :forwarded_port, guest: 3389, host: 3389 
    config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true 
    config.vm.provider "virtualbox" do |vb| 
        vb.name = "erwin-win10x64" 
    end 
end

Vagrantfile to use.
# -*- mode: ruby -*-
# vi: set ft=ruby :

# See README.md for details

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "win10"#vagrantcloud.com

  config.vm.define "acs" do |acs|
  
    acs.vm.hostname = "acs"
    acs.vm.network "private_network", ip: "172.32.0.201"
 acs.vm.provider "virtualbox" do |vb| 
        vb.name = "acs-win10x64" 
    end 
  
  end
  
  config.vm.define "web" do |web|
  
    web.vm.hostname = "web"
    web.vm.box = "win10"
    web.vm.network "private_network", ip: "172.32.0.202"
 web.vm.provider "virtualbox" do |vb| 
        vb.name = "web-win10x64" 
    end 

  end
  
  
  config.vm.define "db" do |db|
    db.vm.box = "win10"
    db.vm.hostname = "db"
    db.vm.network "private_network", ip: "172.32.0.203"
 db.vm.provider "virtualbox" do |vb| 
        vb.name = "db-win10x64" 
    end 
  end
  
end

Vagrantbox other setting/main ref

With the above image, you might errors with macID and ports already in use.
So, once the image is extracted to the folders.
C:\Users\UdayKiranReddy\.vagrant.d\boxes\win10\0\virtualbox
Delete the entries in Vagrantfile and include\Vagrantfile in the above folder.

One more sample of Vagrantfile:


# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.define "control" do |ctl|
    ctl.vm.box = "trusty64"
    ctl.vm.hostname = "ubuntu-control"
    ctl.vm.network "private_network", ip: "142.168.57.2"
    ctl.vm.provider "virtualbox" do |vb|
      vb.memory = 1024
    end
  end
  
  config.vm.define "webserver01" do |web01|
    web01.vm.box = "win10"
    web01.vm.hostname = "windows-webserver01"
    web01.vm.communicator = "winrm"
    web01.winrm.username = "vagrant"
    web01.winrm.password = "vagrant"
    web01.vm.network "private_network", ip: "142.168.57.3"
    web01.vm.provider "virtualbox" do |vb|
      vb.memory = 2048
      vb.cpus = 2
    end
  end
  
end

No comments:

Post a Comment