New issue
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 SSH error when running provision playbook on Ubuntu images #193
Comments
👋 Hi @aguduszeit I believe this issue has been resolved with the latest release of the Ansible and vSphere plugins. Can you please upgrade your versions of the plugins to the latest version and try again. |
The issue is with Linux system configuration for SSH. This is similarly noted noted in the Solution: Update PubkeyAcceptedAlgorithms ssh-rsa
HostkeyAlgorithms ssh-rsa See vmware-samples/packer-examples-for-vsphere#207 for the same closed issue by @aguduszeit. Hope that helps. Ryan Johnson |
@nywilken - this one can be closed. See vmware-samples/packer-examples-for-vsphere#207 for the same closed issue by @aguduszeit. Ryan Johnson |
@tenthirtyam thanks for the update on this issue. I see the fix being a change to the SSH configuration for the OS under build. I am curious if this change is still needed after the vSphere v1.0.3 plugin release which contained a fix to the Go crypto/ssh client containing a fix for legacy key algorithms. See details here I'm going to close this issue but feel free to drop a comment if you have anything to add about ☝️ |
I actually tested it today with v1.0.5 and it was still required. It might be possible to modify the ansible.cfg to pass ssh_args, but I've not had any luck with that approach. Ryan Johnson |
Overview of the Issue
When building Ubuntu images, ansible failed to connect to the VM with ssh with the following error:
Failed to connect to the host via ssh: Unable to negotiate with 127.0.0.1 port 38741: no matching host key type found. Their offer: ssh-rsa
Reproduction Steps
Command to run
packer build \ -force -on-error=ask \ --only vsphere-iso.linux-ubuntu \ -var-file="config/vsphere.pkrvars.hcl" \ -var-file="config/ansible.pkrvars.hcl" \ -var-file="config/build.pkrvars.hcl" \ -var-file="config/common.pkrvars.hcl" \ builds/linux/ubuntu/22-04-lts
Packer Version
Packer 1.8.0
Plugin Version and Builders
vsphere-plugin 1.0.4
Builder: builds/linux/ubuntu/18-04-lts/linux-ubuntu.pkr.hcl
vsphere-iso
vsphere-clone
VMware vSphere Version
VMware vSphere version: 7.0.2
Guest Operating System
Ubuntu 22.04 LTS x64
Ubuntu 18.04 LTS x64
Simplified Packer Buildfile
No change on the build file
Operating System and Environment Details
Kali Linux on wsl2
Log Fragments and
crash.log
Files2022/05/26 01:23:47 packer-provisioner- plugin: -playbook version: 2.12.4
2022/05/26 01:23:47 ui: ==> vsphere-iso.linux-ubuntu: Provisioning with Ansible...
2022/05/26 01:23:47 ui: vsphere-iso.linux-ubuntu: Setting up proxy adapter for Ansible....
2022/05/26 01:23:47 packer-provisioner- plugin: Creating inventory file for Ansible run...
2022/05/26 01:23:47 packer-provisioner- plugin: SSH proxy: serving on 127.0.0.1:38067
2022/05/26 01:23:47 ui: ==> vsphere-iso.linux-ubuntu: Executing Ansible: -playbook -e packer_build_name="linux-ubuntu" -e packer_builder_type=vsphere-iso -e packer_http_addr=172.30.105.111:0 --ssh-extra-args '-o IdentitiesOnly=yes' --extra-vars display_skipped_hosts=false --extra-vars BUILD_USERNAME= --extra-vars BUILD_SECRET=***** --extra-vars ANSIBLE_USERNAME= --extra-vars ANSIBLE_SECRET=***** -e _ssh_private_key_file=/tmp/-key3651137202 -i /tmp/packer-provisioner-2855013751 /tmp/packer-examples-for-vsphere//main.yml
2022/05/26 01:23:47 ui: vsphere-iso.linux-ubuntu: [DEPRECATION WARNING]: COMMAND_WARNINGS option, the command warnings feature is
2022/05/26 01:23:47 ui: vsphere-iso.linux-ubuntu: being removed. This feature will be removed from -core in version 2.14.
2022/05/26 01:23:47 ui: vsphere-iso.linux-ubuntu: Deprecation warnings can be disabled by setting deprecation_warnings=False in
2022/05/26 01:23:47 ui: vsphere-iso.linux-ubuntu: .cfg.
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu:
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu: PLAY [all] *********************************************************************
2022/05/26 01:23:48 packer-provisioner- plugin: SSH proxy: accepted connection
2022/05/26 01:23:48 ui error: ==> vsphere-iso.linux-ubuntu: failed to handshake
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu:
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu: TASK [Gathering Facts] *********************************************************
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Unable to negotiate with 127.0.0.1 port 38067: no matching host key type found. Their offer: ssh-rsa", "unreachable": true}
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu:
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu: PLAY RECAP *********************************************************************
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu: default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
2022/05/26 01:23:48 ui: vsphere-iso.linux-ubuntu:
2022/05/26 01:23:48 packer-provisioner- plugin: shutting down the SSH proxy
2022/05/26 01:23:48 [INFO] (telemetry) ending
2022/05/26 01:23:48 ui error: ==> vsphere-iso.linux-ubuntu: Error executing Ansible: Non-zero exit status: exit status 4
The text was updated successfully, but these errors were encountered: