Open thunderpants73 opened 1 week ago
Hi @thunderpants73,
That doesn't surprise me, the full image embeds Packer and the Ansible plugin, but not ansible itself. This is something we should probably investigate/fix, but I would suggest running commands to install those before invoking a build on your template in the meantime.
@lbajolet-hashicorp - We did try that. We added the ansible packages to the Docker image. The error above is what we get with those packages added.
RUN apk add ansible jq openssh bash curl py3-boto3 sudo
That is strange; I've tried to run this in a local hashicorp/packer container, only running apk install ansible && ansible-playbook --version
, which succeeds as expected; it seems unlikely, but if you try to invoke ansible-playbook --version
manually on your container, could you report what happens?
Yep, we did that as well. This is the output from our pipeline.
12:39:24 #5 [2/2] RUN apk add ansible jq openssh bash curl py3-boto3 sudo && ansible-playbook --version
12:39:32 #5 7.574 OK: 625 MiB in 132 packages
12:39:32 #5 8.090 ansible-playbook [core 2.17.0]
12:39:32 #5 8.090 config file = None
12:39:32 #5 8.090 configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
12:39:32 #5 8.090 ansible python module location = /usr/lib/python3.12/site-packages/ansible
12:39:32 #5 8.090 ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
12:39:32 #5 8.090 executable location = /usr/bin/ansible-playbook
12:39:32 #5 8.090 python version = 3.12.6 (main, Sep 11 2024, 08:48:26) [GCC 13.2.1 20240309] (/usr/bin/python3)
12:39:32 #5 8.090 jinja version = 3.1.4
12:39:32 #5 8.090 libyaml = True
12:39:44 #5 DONE 18.4s
12:40:03 Error: Failed preparing provisioner-block "ansible" ""
12:40:03
12:40:03 on template.pkr.hcl line 46:
12:40:03 (source code not available)
12:40:03
12:40:03 1 error(s) occurred:
12:40:03
12:40:03 * Error running "ansible-playbook --version": exit status 5
What does exit status 5
mean? I tried looking through the source for the plugin but the error seemed fairly generic.
When using the ansible provisioner with the hashicorp/packer docker image ansible-playbook fails to run with the following error:
I've tried this with multiple versions of the docker image, all error with the same thing. My provisioner block is very simple:
Has anyone seen this issue before?