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] <javascript:>> 
> 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] <javascript:>.
> 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/msgid/packer-tool/b5ba2275-3ca2-4997-b72b-93a04ac5070b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to