We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ansible provisioner fails when run by Packer, runs successfully on its own. Same environment, same hosts, same inventory, same vars.
packer build -on-error ask -force -var-file kali-repo/packer/2021.1.json kali-repo/packer/kali-base.json
ansible-playbook
1.7.2
Provisiner setup:
... "provisioners": [ { "type": "ansible", "user": "kali", "use_proxy": false, "keep_inventory_file": true, "playbook_file": "kali-repo/ansible/base-playbook.yml", "extra_arguments": [ "--extra-vars", "\"ansible_user=kali ansible_password=kali ansible_sudo_pass=kali ansible_become_method=sudo ansible_become_user=root ansible_host={{ build `Host` }} ansible_port=22 ansible_ssh_common_args='-o StrictHostKeyChecking=no' ansible_password=kali\"" ], "ansible_env_vars": [ "ANSIBLE_HOST_KEY_CHECKING=False" ] } ], ...
64 bit Alpine Linux container
Packer:
==> vsphere-clone: Provisioning with Ansible... vsphere-clone: Not using Proxy adapter for Ansible run: vsphere-clone: Using ssh keys from Packer communicator... ==> vsphere-clone: Executing Ansible: ansible-playbook -e packer_build_name="vsphere-clone" -e packer_builder_type=vsphere-clone -e packer_http_addr=10.80.0.18:0 --ssh-extra-args '-o IdentitiesOnly=yes' --extra-vars "ansible_user=kali ansible_password=kali ansible_sudo_pass=kali ansible_become_method=sudo ansible_become_user=root ansible_host=172.16.50.19 ansible_port=22 ansible_ssh_common_args='-o StrictHostKeyChecking=no' ansible_password=kali" -e ansible_ssh_private_key_file=/tmp/ansible-key061932775 -i /tmp/packer-provisioner-ansible235206426 /tmp/build/put/kali-repo/ansible/base-playbook.yml vsphere-clone: vsphere-clone: PLAY [configure Kali base] ***************************************************** vsphere-clone: vsphere-clone: TASK [Gathering Facts] ********************************************************* vsphere-clone: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '172.16.50.19' (ECDSA) to the list of known hosts.\r\nLoad key \"/tmp/ansible-key061932775\": invalid format\r\nkali@172.16.50.19: Permission denied (publickey,password).", "unreachable": true} vsphere-clone: to retry, use: --limit @/tmp/build/put/kali-repo/ansible/base-playbook.retry vsphere-clone: vsphere-clone: PLAY RECAP ********************************************************************* vsphere-clone: default : ok=0 changed=0 unreachable=1 failed=0 vsphere-clone: ==> vsphere-clone: Error executing Ansible: Non-zero exit status: exit status 4
Ansible:
ansible-playbook -e packer_build_name="vsphere-clone" -e packer_builder_type=vsphere-clone -e packer_http_addr=10.80.0.18:0 --ssh-extra-args '-o IdentitiesOnly=yes' --extra-vars "ansible_user=kali ansible_password=kali ansible_sudo_pass=kali ansible_bec ome_method=sudo ansible_become_user=root ansible_host=172.16.50.19 ansible_port=22 ansible_ssh_common_args='-o StrictHostKeyChecking=no' ansible_password=kali" -e ansible_ssh_private_key_file=/tmp/ansible-key061932775 -i /tmp/packer-provisioner-ansible235206426 /tmp/bui ld/put/kali-repo/ansible/base-playbook.yml PLAY [configure Kali base] *************************************************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ******************************************************************************************************************************************************************************************************************************************************* [WARNING]: Module invocation had junk after the JSON data: AttributeError("module 'platform' has no attribute 'dist'") KeyError('ansible_os_family') ok: [default] TASK [Pause for 1 minute] **************************************************************************************************************************************************************************************************************************************************** Pausing for 5 seconds (ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort) ok: [default] TASK [Install xrdp] ********************************************************************************************************************************************************************************************************************************************************** changed: [default]
The text was updated successfully, but these errors were encountered:
Reading over the issues right now, this is probably a duplicate of #6
Sorry, something went wrong.
No branches or pull requests
Overview of the Issue
Ansible provisioner fails when run by Packer, runs successfully on its own. Same environment, same hosts, same inventory, same vars.
Reproduction Steps
packer build -on-error ask -force -var-file kali-repo/packer/2021.1.json kali-repo/packer/kali-base.json
ansible-playbook
command Packer specifies in the output. It'll run without fail:Packer version
1.7.2
Simplified Packer Buildfile
Provisiner setup:
Operating system and Environment details
64 bit Alpine Linux container
Log Fragments and crash.log files
Packer:
Ansible:
The text was updated successfully, but these errors were encountered: