that seems like a useful feature add. To obtain the IP via powershell within the packer script and save it as a variable, any idea the easiest way to do that? i haven't actually done that before.. but is sounds like it should work
regards James On Sat, Jun 24, 2017 at 9:19 AM, Gabo Kete <[email protected]> wrote: > I think the guest_ip address is not exported as an environmental variable > and only used within the packer code.. what you can do instead is to create > a small powershell script to get the guest IP address and use that variable > instead > > 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/ms >>> gid/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 a topic in the > Google Groups "Packer" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/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/ > msgid/packer-tool/0dabf81d-018e-4d8c-a238-cd96dbdcd36d%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/0dabf81d-018e-4d8c-a238-cd96dbdcd36d%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/msgid/packer-tool/CAB_oJUtD6oHC-BSrX4SY4Tjg2A7rJHACCZ2p0cmStViNrof8Ew%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
