I've looked into this a bit more, and I believe the core of the problem is in the generation of the temporary host file. I hacked line 276 in the ansible/provisioner.go file (the host definition line) and hardcoded in "packer-consulserver" in place of p.config.HostAlias. This worked for me and my group vars were associated with the packer-consulserver ansible host.
Off hand, I wonder if a configuration could be added to the ansible provisioner that would allow the default host generation behavior to be modified. One idea - though I don't know if it will work -would be to allow the user to specify an existing hosts file to use rather than to generate one. If doable, this could potentially allow me to use my test/stage/production ansible hosts file. There is one work around that I've discovered. One can add the group variables and their values into the variables section of the packer template. Really non-DRY and really ugly IMO. What I'd like to do, is to enter an issue on this. Even if the choice is not to make the change or not to commit the resources, the problem should be filed, and the documentation updated to make users aware of the issue and potential work around. I would consider submitting a patch but I would want to have a clear sense of how it should be implemented. Also in the way is my limited knowledge of Golang and the overall architecture of the ansible provisioner and its relationship to the lxd builder. -steve -- 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/c52f5d5d-a10c-41a8-9245-3695c84e78b9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
