Hello all, I’m trying to get ansible to run on docker but can’t get it working. I’ve tried to “translated” JSON to HCL.
So I’m guessing the failure lies there, most likely with the “run_command” Don’t know how to make it HCL, I haven’t really use variables so don’t how it should work with Packer.
Is there any way you can share relevant parts of the playbook? It sounds like there’s a user which Ansible is expecting which is not present (test). The hostname and connection seem set correctly. Perhaps try setting the ansible_user variable to a user which is known to be present on the image (root).
Thanks for that! I didn’t notice before that it seems that the Packer template doesn’t have a build block.
I still can’t tell what is causing the error you show in the output (no reference to test in the output for example), but it could be that you need move the provisioner block into a build block.
I can point you to one of the templates I use often:
This template is specifically for creating test instances for CI/CD of the Ansible role that the repo contains - your use case sounds pretty similar.