Open flixman opened 2 years ago
@azr Excuse me for naming you explicitly here. I had posted a similar bug in the packer-plugin-ansible, but my following findings have made me think I should be reporting this question about how to reference the instance_id from the packer file. This is really blocking me to continue with my work, and.... I do not know who else can I turn to. Can you/somebody give me a hand?
@flixman Does build.ID
work for you? It should output container id.
provisioner "powershell" {
inline = ["Write-Output '${build.ID}'"]
}
Overview of the Issue
I have a packer file containing the following:
Ansible fails the first time that tries to connect to the docker container (when doing the initial host scan, called "facts gathering" in Ansible). And I suspect is because the contents of the inventory file are like
By setting the host_alias parameter in ansible provisioner I can work around this situation. However, I do not get to see how can I reference the builder.instance_id variable from the config file.
Plugin and Packer version
packer version: 1.7.4 I do not know how to get the plugin versions