Hi Alvaro,

I tried going with your advice a while back and got side tracked with some 
other projects.  I was never able to get the provisioned box working. 
 Essentially, I have done up to the following and then I hit a boot timeout 
error with Vagrant:


   1. Create base box with Windows Updates and upload up to Atlas
   2. Get base box from Atlas and provision Visual Studio, SQL Server, and 
   some other default applications for the VM
   3. Use VBoxManage Export to create an .ova file and store it locally on 
   my host
   4. Use Packer to package up my .ova file with software installed and 
   store it locally
   5. Use VagrantFile to access the newly created box from Packer
   6. vagrant up gets to "Waiting for machine to boot." and times out

I tried increasing the boot timeout to 3600 but it didn't matter.  Not sure 
what's going on at this point but it doesn't seem like WinRM is able to 
communicate.  

My WinRM address shows 127.0.0.1:55985 and vagrant user is "vagrant".

Any help is greatly appreciated.

On Friday, February 12, 2016 at 1:07:14 AM UTC-8, Alvaro Miranda Aguilera 
wrote:
>
> Hello Christopher,
>
> Couple of comments here.
>
> 1. I have seen lots of people use chocolatey to install software, I think 
> they got MS VS there too,
> 2. Once the VM is installed, you should think into either package the box 
> and create your own box with MS VS Installed, so you save time on the next 
> run
> or, you can create your own box with MS VS installed.
>
> the box it self will be a bit larger, but having the software on it, will 
> make it easier to run :)
>
> For 2.a (chocolatey on vagrant) have a look at this:
>
> http://digitaldrummerj.me/vagrant-provisioning-with-chocolatey/
>
> For 2.b, (packer)
>
> you can see the installer of chocolatey here:
>
> https://github.com/dylanmei/packer-windows-templates/blob/master/scripts/chocolatey.ps1
>
> And a sample project here:
> https://github.com/dylanmei/packer-windows-templates
>
> Hope this helps
> Alvaro.
>
> On Wed, Feb 10, 2016 at 11:19 AM, Christopher <[email protected] 
> <javascript:>> wrote:
>
>> Thanks your help Alvaro.  Sorry for the late response on this but your 
>> response got me headed in the right direction.  Your solution specifically 
>> mentions Linux.  I am on Windows so I figured I would put my solution up as 
>> well.
>>
>> I took what you said and adjusted my Vagrantfile and provisioners to 
>> mount one .iso at time.  Once the application is finished uninstalling, I 
>> unmount the .iso and then mount the next one.
>>
>> There was a gotcha though.  I had to copy over the .iso file to a 
>> temporary folder first so that I could properly mount it.  I also did it in 
>> a way where I did not have to target a specific drive letter.
>>
>> Here's the relevant portion of my Vagrantfile:
>>
>> Vagrant.configure(2) do |config|
>> ...
>>   # =================================================================
>>   # PROVISIONING
>>   # Additional provisioners such as Puppet, Chef, Ansible, Salt, and 
>> Docker are also available.
>>   # Please see the Vagrant documentation for more information about 
>> their specific syntax and use.
>>   # =================================================================
>>   config.vm.provision "file", source: 
>> "C:/Hashicorp/Vagrant/provisioners/install-visualstudio.ps1", destination
>> : "C:/tmp/vagrant-shell/install-visualstudio.ps1"
>>
>>   # Provision Visual Studio
>>   config.vm.provision "shell", inline: 
>> "C:/tmp/vagrant-shell/install-visualstudio.ps1", run: "always"
>> ...
>> end
>>
>> And here's my install-visualstudio.ps1 file:
>>
>> $vspath = "C:\Program Files (x86)\Microsoft Visual Studio 12.0"
>> if (test-path $vspath)
>> {
>>  Write-Host "Visual Studio is already installed...we can skip this step."
>> }
>> else {
>>  Write-Host "Installing Visual Studio 2013 with Update 5..."
>>  Write-Host "This will take a while so maybe grab some coffee or tea?"
>>  Write-Host "Copying ISO file to local file system"
>>  Copy-Item "\\VBOXSVR\ISO_Installers\Microsoft\Visual Studio\2013 with 
>> Update 5\en_visual_studio_ultimate_2013_with_update_5_x86_dvd_6815896.iso" 
>> -Destination "C:\tmp\"
>>
>>  Write-Host "Mounting the ISO file"
>>  $iso = "C:/tmp/
>> en_visual_studio_ultimate_2013_with_update_5_x86_dvd_6815896.iso"
>>  Mount-DiskImage -verbose -ImagePath $iso -StorageType ISO
>>
>>  # Get the drive letter that the ISO was mounted to so that we can access 
>> the installer.
>>  $image = Get-DiskImage -ImagePath $iso | Get-Volume
>>  $drive = "$([string]$image.DriveLetter):"
>>
>>  $p = New-Object System.Diagnostics.Process
>>  $pinfo = New-Object System.Diagnostics.ProcessStartInfo("$drive\
>> vs_ultimate.exe", "/full /quiet /norestart");
>>  $p.StartInfo = $pinfo;
>>  $start = Get-Date -displayhint time
>>  $p.Start();
>>  $p.WaitForExit();
>>  $end = Get-Date -displayhint time
>>  $time = NEW-TIMESPAN -Start $start -End $end
>>  Write-Host "Visual Studio 2013 with Update 5 installed.  Time taken (
>> minutes): " $time.TotalMinutes
>>  Write-Host "Dismounting the Visual Studio ISO file..."
>>  Dismount-DiskImage -ImagePath $iso
>> }
>>
>> Write-Host "Deleting the Visual Studio 2013 with Update 5 ISO file..."
>> $file = "C:/tmp/
>> en_visual_studio_ultimate_2013_with_update_5_x86_dvd_6815896.iso"
>> if (Test-Path $file){
>>  Remove-Item $file
>> }
>>
>>
>> Write-Host "install-visualstudio.ps1 complete..."
>>
>> You'll notice that even if the provisioner runs every time, it does not 
>> attempt to install Visual Studio if it is already completed.
>>
>> Hope this helps anyone else that comes across the same issue.
>>
>> Christopher
>>
>> On Monday, February 1, 2016 at 11:45:08 PM UTC-8, Alvaro Miranda Aguilera 
>> wrote:
>>>
>>> Hello Christopher.
>>>
>>> What you can do, is use the IDE controller for your iso, so you will now 
>>> is always IDE.
>>>
>>> However, you may hit the same issue,
>>>
>>> depening on the OS where the box was created, it could be
>>>
>>> SATA Controller or SATA
>>>
>>> so maybe the ide would be
>>>
>>> IDE Controller vs IDE
>>>
>>> If the box is linux, you should be able to mount the iso just fine.
>>>
>>> Do a shared folder to path/to/
>>>
>>> then on the OS:
>>>
>>> mkdir -p /mnt/dvd
>>> mount -o loop,ro /path/file.iso /mnt/dvd
>>>
>>> <magic>
>>>
>>> umount /mnt/dvd
>>>
>>> Hope this helps
>>> Alvaro.
>>>
>>>
>>> On Tue, Feb 2, 2016 at 11:43 AM, Christopher <[email protected]> 
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm looking to make my vagrant file idempotent and almost have it.  
>>>> However, when I run *vagrant up --provision* on a machine that has 
>>>> already been created, I get an error about my SATA storage controller.  To 
>>>> avoid this, I have to manually delete the controller in Virtualbox and run 
>>>> the command again.  Removing my SATA controller is ok because it is only 
>>>> used to host ISO files that I am accessing directly to install some 
>>>> software.
>>>>
>>>> Is this even possible?  I'd like to make my provision a little smarter 
>>>> in case I have to force provision an already created machine.  Here's my 
>>>> provider config below:
>>>>
>>>> config.vm.provider "virtualbox" do |vb|
>>>>     # Display the VirtualBox GUI when booting the machine
>>>>     vb.gui = true
>>>>     
>>>>     # Customize the amount of memory on the VM:
>>>>     vb.memory = 4096
>>>>     
>>>>     # Customize the amount of CPUs the VM will use:
>>>>     vb.cpus = 2
>>>>     vb.customize ["modifyvm", :id, "--vram", "128"]
>>>>     vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
>>>>     # Customize additional Virtualbox settings
>>>>     vb.customize ["sharedfolder", "add", :id, "--name", "VM_Share", 
>>>> "--hostpath", "path/to/share/folder/", "--automount"]
>>>>
>>>>
>>>>     #below commented SATA customize will only work when the VM has 
>>>> already been created...on a fresh run this will error since the SATA 
>>>> controller does not exist
>>>>     #vb.customize ["storagectl", :id, "--name", "SATA", "--remove" ]
>>>>     vb.customize ["storagectl", :id, "--name", "SATA", "--add", "sata" 
>>>> ]
>>>>
>>>>
>>>>     # Add an ISO file here
>>>>     vb.customize ["storageattach", :id, "--storagectl", "SATA", 
>>>> "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", 
>>>> "path/to/file.iso"]
>>>>
>>>>
>>>>     # Add another ISO file here
>>>>     vb.customize ["storageattach", :id, "--storagectl", "SATA", 
>>>> "--port", "1", "--device", "0", "--type", "dvddrive", "--medium", 
>>>> "path/to/file.iso"]
>>>>   end
>>>>
>>>> Thanks in advance,
>>>>
>>>> Christopher
>>>>
>>>> -- 
>>>> This mailing list is governed under the HashiCorp Community Guidelines 
>>>> - https://www.hashicorp.com/community-guidelines.html. Behavior in 
>>>> violation of those guidelines may result in your removal from this mailing 
>>>> list.
>>>>  
>>>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>>>> IRC: #vagrant on Freenode
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Vagrant" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/vagrant-up/890ada33-53a2-4950-bdf9-72c951193c32%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/vagrant-up/890ada33-53a2-4950-bdf9-72c951193c32%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>> IRC: #vagrant on Freenode
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Vagrant" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/vagrant-up/05a6169c-a0ad-422e-bace-c030a1514cf3%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/vagrant-up/05a6169c-a0ad-422e-bace-c030a1514cf3%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/749ac136-60f5-4407-aae8-0e4acdf96898%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to