Hyperv_ISO how to bring large files to host

416 views
Skip to first unread message

Woopa

unread,
Jun 22, 2017, 3:06:23 AM6/22/17
to Packer
Hi guys,

I am pretty new to packer, and I have been facing a blocking issue.

I have been provisioning my servers well, and injecting all the scripts using the "Floppy_files" section until now. (on a totally isolated network, which means, not internet for that node).

I am facing an issue where I need to bring large files to my node so that I can install them. (I need to install dot net 4.6.2 and WMF 5.1 around 150mo or so). 
The floppy section (of course) didn't worked due to the lack of space available on a floppy.

Can any of you guys point me to the easiest way to have my sources copied over locally? or how I could make these files available on that hosts in other way?

thanks in advance!

Alvaro Miranda Aguilera

unread,
Jun 22, 2017, 3:40:18 AM6/22/17
to packe...@googlegroups.com
Hello

Use the http feature of packer, put all the files in a directory, and let packer to serve from there.

"http_directory": "http",

then say you have http/dotnet.msi

that will be available on:
http://{{ .HTTPIP }}:{{ .HTTPPort }}/dotnet.msi

If you use powershell, the variables should be available to your script environment.

Other option is, I think the floppy should be able to manage large files, did you tried it?

Other option is crate a custom iso that include all the files you need.


Alvaro

--
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/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/1491f083-665d-4442-a60b-51385bcac261%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Rickard von Essen

unread,
Jun 22, 2017, 4:04:50 AM6/22/17
to packe...@googlegroups.com
Slight correction. PowerShell provisioner will not have access to the HTTPIP and HTTPPort template variables, only the boot_command section in the builder. 

Woopa

unread,
Jun 22, 2017, 5:30:53 AM6/22/17
to Packer
What does that concretly mean Rickard? That we cannot use the HTTP server for provisiong tasks (in other words, I cannot bring my packages with that method on my node?)

@Alvaro: Thanks for the hints. 

I actually tried using a HTTP_directory but I couldnt reach it (I was expecting to be able to browse directly to it via internet explorer using the IP and the port that are specified in the output:

 ==> hyperv-iso: Creating temporary directory...
==> hyperv-iso: Downloading or copying ISO
    hyperv-iso: Downloading or copying: file:///C:/Users/taavast3/Downloads/en_windows_server_2012_r2_with_update_x64_dvd_6052708%20%281%29.iso
==> hyperv-iso: Creating floppy disk...
    hyperv-iso: Copying files flatly from floppy_files
    hyperv-iso: Copying file: answer_files/2012_r2/Autounattend.xml
    hyperv-iso: Copying file: scripts/config_winrm.ps1
    hyperv-iso: Copying file: scripts/config_remotedesktop.ps1
    hyperv-iso: Copying file: scripts/config_tattoo.ps1
    hyperv-iso: Copying file: scripts/LaunchScripts.ps1
    hyperv-iso: Copying file: scripts/start.ps1
    hyperv-iso: Copying file: scripts/ALL-IMP-PowershellUpgrade/__Inputs/Additional-Commands.psm1
    hyperv-iso: Copying file: scripts/ALL-IMP-PowershellUpgrade/ALL-IMP-PowershellUpgrade.ps1
    hyperv-iso: Copying file: scripts/ALL-IMP-PowershellUpgrade/sources/Win8.1AndWK12R2-KB3191564-x64.msu
    hyperv-iso: Copying file: scripts/ALL-IMP-PowershellUpgrade/sources/NDP462-KB3151800-x86-x64-AllOS-ENU.exe
    hyperv-iso: Done copying files from floppy_files
    hyperv-iso: Collecting paths from floppy_dirs
    hyperv-iso: Resulting paths from floppy_dirs : []
    hyperv-iso: Done copying paths from floppy_dirs
==> hyperv-iso: Starting HTTP server on port 8172
==> hyperv-iso: Creating switch 'packer-hyperv-iso' if required...
==> hyperv-iso:     switch 'packer-hyperv-iso' already exists. Will not delete on cleanup...
==> hyperv-iso: Creating virtual machine...
==> hyperv-iso: Enabling Integration Service...
==> hyperv-iso: Setting boot drive to os dvd drive C:/Users/taavast3/Downloads/en_windows_server_2012_r2_with_update_x64_dvd_6052708 (1).iso ...
==> hyperv-iso: Mounting os dvd drive C:/Users/taavast3/Downloads/en_windows_server_2012_r2_with_update_x64_dvd_6052708 (1).iso ...
==> hyperv-iso: Mounting floppy drive...
==> hyperv-iso: Skipping mounting Integration Services Setup Disk...
==> hyperv-iso: Mounting secondary DVD images...
==> hyperv-iso: Configuring vlan...
==> hyperv-iso: Starting the virtual machine...
==> hyperv-iso: Waiting 10s for boot...
==> hyperv-iso: Host IP for the HyperV machine: 169.254.127.211
==> hyperv-iso: Typing the boot command...
==> hyperv-iso: Waiting for WinRM to become available...

I tried to connect (from my node) to http://169.254.127.211:8172
I was expecting to see the list of files that were in the HTTP_Directory.

I didn't try to use a direct URL to the file as Alvaro mentioned (I am currently redeploying, and i'll try as soon as possible

Concerning the ISO, I have create an ISO as mentionned here https://www.packer.io/docs/builders/hyperv-iso.html#iso_urls and added that iso in my configuration file undere the property "Secondary_iso_images".
"secondary_iso_images": "Windows2012R2/Repository.iso"

The next question I have is how can I know on which drive letter this ISO file while be mounted?
Also, more generaly, how can I access packer variables in my powershell session? Do I have to specify in the "variables" : [] section? And how do I read the values with powershell afterwards? 
$env:MyPackerVariable ?

An example would be great!


--
Alvaro

--
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/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.

Alvaro Miranda Aguilera

unread,
Jun 22, 2017, 5:54:07 AM6/22/17
to packe...@googlegroups.com
Hi

i seems in 1.0.1 a new variable was added.

PACKER_HTTP_ADDR

Seems documentation is pending, but its explained here:

So that goes aligned with what Rickard said.

I am sorry that I can't help you with Poweshell example :(

Alvaro.


To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/ef203d59-63e5-4b16-bb7a-0f6fd88e3031%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Jun 22, 2017, 6:02:11 AM6/22/17
to packe...@googlegroups.com

Rickard von Essen

unread,
Jun 22, 2017, 10:53:37 AM6/22/17
to packe...@googlegroups.com
Yeh, totally forgot that, it was added since the performance of WinRM upload is really poor.

So in your powershell script there should be a PACKER_HTTP_ADDR env var that you can use to access the http_dir from within the guest.

Reply all
Reply to author
Forward
0 new messages