Skip to content
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

Can't use Ansible provisioner with just SSH username and password #156

Open
rsmithcooper opened this issue May 17, 2023 · 1 comment
Open
Labels

Comments

@rsmithcooper
Copy link

Overview of the Issue

I am trying to run an Ansible script for my vsphere image build but it looks like it keeps trying to authenticate using a key when all it should use is a username/password. This username and password works fine during the VM build and I can also SSH into the machine during this time but it keeps failing for the ansible provisioner.

Reproduction Steps

Try running the Ansible provisioner on a vsphere-iso image build using only username and password to run the ansible file. No key exists.

Plugin and Packer version

1.8.6

Simplified Packer Buildfile

    build {
      sources = ["source.vsphere-iso.ubuntu"]
    
      provisioner "ansible" {
        playbook_file = "./ansible/main.yml"
        user = local.admin_user
        extra_arguments = [
          "--extra-vars", "ansible_ssh_pass=${local.admin_pass}",
        ]
      }
    }

Operating system and Environment details

Using packer from MacOS and building an Ubuntu 22.04 image on vsphere

Log Fragments and crash.log files

vsphere-iso.ubuntu: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '[127.0.0.1]:55497' (RSA) to the list of known hosts.\r\nsign_and_send_pubkey: no mutual signature supported\r\[email protected]: Permission denied (publickey).", "unreachable": true}
@h289072
Copy link

h289072 commented Oct 9, 2023

Have you tried this?

extra_arguments = [
          "--extra-vars", "ansible_password=${local.admin_pass}",
]

The ansible variable name has changed (a long time ago...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants