How connect to win host when run packer provisioner ansible?

Hello! Thanks for packer!

I try build windows image by packer with provisioner ansible.

When use provisioners type ansible: Run ansible on workstation of developer or Run ansible on instance in cloud ?

packer.drawio

If “use_proxy”: true, then use 127.0.0.1.
If “use_proxy”: false, then use real ip of virtual machine.
Is it right?

To run ansible from the build system / workstation against the image you use:

provisioner “ansible” {
}

to have it run on directly on the image you use:

provisioner “ansible-local” {
}

but ansible local requires ansible to be installed on that system, so you building a windows image, that isn’t possible (without some work and problems) so remote will be required.

The use_proxy is for connecting to things that don’t have an IP for some reason so one can be provided to ansible like containers

2 Likes