This is by design not exposed. See https://github.com/hashicorp/packer/issues/3331 and linked issues.
On 26 June 2017 at 00:47, James Elmes <[email protected]> wrote: > Yes i dont't really want to stand up a HTTP server just for this, theres > already enough moving parts with automating image creation.. initiating he > copy from the local-shell would be perfectly fine if i could reference the > guest IP (which packer knows) easily > > regards > > James > > On Sun, Jun 25, 2017 at 2:54 PM, Rickard von Essen < > [email protected]> wrote: > >> And if you use the file privisioner with WinRM with larger files you will >> find that it's slow. The workaround is to use http_directory and >> environment variable PACKER_HTTP_ADDR, see https://www.packer.io/docs >> /provisioners/powershell.html#packer_http_addr >> >> On Jun 24, 2017 01:23, "Gabo Kete" <[email protected]> wrote: >> >>> If what you are after ( looking at the piece of JSON file you shared ) >>> is to upload a file from your packer machine to the guest machine , I would >>> recommend you use File provisioner instead ( link below ), which will help >>> you to upload a file without knowing the guest IP address >>> >>> >>> https://www.packer.io/docs/provisioners/file.html >>> >>> >>> >>> On Friday, June 23, 2017 at 2:03:10 PM UTC+12, James Elmes wrote: >>>> >>>> Should have mentioned i am using windows.. >>>> >>>> I know how to copy files to the guest vm, i am trying to initiate the >>>> copy from the local windows server i am running packer on. I am doing this >>>> manually using the shell-local command >>>> >>>> "type": "Shell-Local" >>>> "command": "xcopy -source C:\packer\vmtools -destination >>>> \\guestip\c$\packer >>>> >>>> The guest IP i am entering manually by checking which dhcp address is >>>> allocated to the guest IP from my AD server >>>> >>>> Packer knows this address already as it connected over SSH/Winrm >>>> without me providing it.. i want to know how i can get it.. using something >>>> like {{guest_IP}} >>>> >>>> James >>>> >>>> On Friday, 23 June 2017 05:12:14 UTC+10, Rickard von Essen wrote: >>>>> >>>>> You can do something like this: >>>>> >>>>> "provisioners": [ >>>>> { >>>>> "type": "shell", >>>>> "inline": [ "hostname > /tmp/hostname" ] >>>>> }, >>>>> { >>>>> "type": "file", >>>>> "direction": "download", >>>>> "source": "/tmp/hostname", >>>>> "destination": "hostname" >>>>> } >>>>> ] >>>>> >>>>> And you will get the hostname in the file "hostname". >>>>> >>>>> You just need to switch to ifconfig etc. If you are building in a >>>>> cloud it might also be possible to use the cli/api if you have an unique >>>>> name/id/tag etc to lookup. >>>>> >>>>> >>>>> On Jun 22, 2017 17:27, "James Elmes" <[email protected]> wrote: >>>>> >>>>> Howdy. >>>>> >>>>> Wondering if there is a way to return the guest IP. I want to initiate >>>>> a file copy from Shell-Local provisioner, this way the copy is initiated >>>>> from the local machine running packer. >>>>> >>>>> example: xcopy -source C:\packer\vmtools -destination >>>>> \\guestip\c$\packer >>>>> >>>>> i have looked everywhere and can't seem to find a way to return the >>>>> actual guest IP >>>>> >>>>> any help appreciated >>>>> >>>>> James >>>>> >>>>> -- >>>>> 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 [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/packer-tool/0db28607-448b- >>>>> 4bf7-b2ec-8aa4a72272ab%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/packer-tool/0db28607-448b-4bf7-b2ec-8aa4a72272ab%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/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 [email protected]. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/packer-tool/7d0a6815-829e-4f30-95cf-bf06688a76db%40googlegroups.com >>> <https://groups.google.com/d/msgid/packer-tool/7d0a6815-829e-4f30-95cf-bf06688a76db%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/packer/issues >> IRC: #packer-tool on Freenode >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "Packer" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/packer-tool/aEtfUbRz0M4/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/packer-tool/CALz9Rt8kei779YhPapk7nzmOKRgaRw%2BVKLs_Q3FZ% >> 3DaBXuDyV%3DA%40mail.gmail.com >> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt8kei779YhPapk7nzmOKRgaRw%2BVKLs_Q3FZ%3DaBXuDyV%3DA%40mail.gmail.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/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 [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/CAB_oJUsC5cho9Tp4a%2Bx8xeMidyzh%3DOYy6vHE41figiD9TTjyug% > 40mail.gmail.com > <https://groups.google.com/d/msgid/packer-tool/CAB_oJUsC5cho9Tp4a%2Bx8xeMidyzh%3DOYy6vHE41figiD9TTjyug%40mail.gmail.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/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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt_ZL4U5tXge-1k%2BfPAA7nSgkfBZrbWeyvh%2BfohCaYrSyA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
