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

SSH into EC2 instance fails with permission error #152

Open
nandac opened this issue May 13, 2023 · 1 comment
Open

SSH into EC2 instance fails with permission error #152

nandac opened this issue May 13, 2023 · 1 comment

Comments

@nandac
Copy link

nandac commented May 13, 2023

Dear Folks,

I am new to molecule and I am trying my hand at using the ec2 driver plugin.

I am able to create the EC2 instance and the required security group but have not been able to successfully login into the machine.

I keep getting the following error message when running molecule create.
fatal: [molecule-instance]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Waiting on browser...\nBrowser step completed successfully.\nerror: Could not resolve: REDACTED: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}

I have only made minimal customizations such as disabling the creation of a public IP so that I may use a private IP instead.

I have pasted the settings I have in my molecule.yml file below:

---
dependency:
  name: galaxy
driver:
  name: ec2
platforms:
  - name: molecule-instance
    assign_public_ip: false
    connection_options:
      ansible_python_interpereter: /usr/bin/python
    image_name: "<REDACTED>"
    image_owner: ["<REDACTED>"]
    instance_type: t3.micro
    region: "<REDACTED>"
    ssh_user: ec2-user
    vpc_id: "<REDACTED>"
    vpc_subnet_id: "<REDACTED>"
    tags:
      Name: molecule-instance
provisioner:
  name: ansible
verifier:
  name: ansible

I know that this issue probably relates more to the Linux AMI I am using which is a slightly customized version of Amazon Linux 2 but I hope you may be able to shed some light.

I tried both the ec2 and cloud-init for the key_inject_methods field but the SSH login does not work.

I look forward to your reply.

Many thanks.

@zhan9san
Copy link
Member

zhan9san commented Dec 2, 2023

@nandac

Would you mind providing more detailed log of molecule create?

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

No branches or pull requests

2 participants