Cool - I've managed to get a simple test working with something like this 
(going to a Windows host):

"provisioners": [
{
"type": "file",
"source": "ip.cmd",
"destination": "C:/tmp/ip.cmd"
},
{
"type": "windows-shell",
"inline": [
"echo [{{ user `ansible_group` }}] > C:/tmp/hosts",
"C:/tmp/ip.cmd"
]
},
{
"type": "file",
"direction": "download",
"source": "C:/tmp/hosts",
"destination": "./ansible/hosts"
},
{
"type": "shell-local",
"command": "ANSIBLE_CONFIG=./ansible.cfg ansible-playbook -v -i 
./ansible/hosts -l \"{{ user `ansible_group` }}\" -e \"ansible_user={{ user 
`username` }} ansible_password={{ user `password` }} ansible_become_pass={{ 
user `password` }} ansible_port=5986 ansible_connection=winrm 
ansible_winrm_server_cert_validation=ignore \" ./ansible/site.yml"
}


where ip.cmd gets the IP address of the Windows host:

@echo off
FOR /F "tokens=2,3" %%A IN ('ping %computername% -n 1 -4') DO IF "from"== 
"%%A" set "IP=%%~B"
echo %IP:~0,-1% >> C:/tmp/hosts


Thanks Jordan and Rickard for your solutions/advice! Will test this out 
more thoroughly to hopefully have all my connection troubles go away! :)  

-- 
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/a0148433-8cf9-4bb6-aef3-a199a10c061a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to