snowdrop / k8s-infra

Information to bootstrap vms using dedicated server, local machine and setup using Ansible Playbooks
Apache License 2.0
29 stars 14 forks source link

Failed to connect to the host via ssh: no such identity: /Users/cmoullia/.ssh/id_rsa_snowdrop_openstack: No such file or directory #333

Closed cmoulliard closed 1 year ago

cmoulliard commented 1 year ago

Issue

This command executd on my machine

ansible-playbook playbook/openstack/openstack_vm_create_passwordstore.yml -e '{"openstack": {"vm": {"network": "provider_net_shared","image": "Fedora-Cloud-Base-35", "flavor": "m1.medium"}}}' -e key_name=test-adm-key -e vm_name=${VM_NAME}

generates this error

Charles Moulliard: Did you get such an error end of the VM creation on RHOS ? @Antonio Costa

TASK [Show 'Wait for connection to host' output] ******************************************************************************************************************************************************************************
Thursday 15 June 2023  15:19:49 +0200 (0:00:02.223)       0:03:07.898 *********
ok: [test] => {
    "msg": [
        "ip : 10.0.76.55",
        "port : 22"
    ]
}

TASK [Wait for connection to host] ********************************************************************************************************************************************************************************************
Thursday 15 June 2023  15:19:49 +0200 (0:00:00.413)       0:03:08.311 *********
fatal: [test]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: no such identity: /Users/cmoullia/.ssh/id_rsa_snowdrop_openstack: No such file or directory\r\nsnowdrop@10.0.76.55: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}

ls -la /Users/cmoullia/.ssh/id_rsa_snowdrop_openstack
ls: /Users/cmoullia/.ssh/id_rsa_snowdrop_openstack: No such file or directory
jacobdotcosta commented 1 year ago

The default openstack ssh key is located at the openstack/id_rsa pass store. You have to copy it's contents to $HOME/.ssh/id_rsa_snowdrop_openstack and chmod 644 $HOME/.ssh/id_rsa_snowdrop_openstack and you'll be ready to go.

cmoulliard commented 1 year ago

The default openstack ssh key is located at the openstack/id_rsa pass store. You have to copy it's contents to $HOME/.ssh/id_rsa_snowdrop_openstack and chmod 644 $HOME/.ssh/id_rsa_snowdrop_openstack and you'll be ready to go.

That should be done automatically ! Why do I have to copy it manually? If not possible, then an ansible warning message should be displayed to tell what to do and process continues

WDYT ? @jacobdotcosta

jacobdotcosta commented 1 year ago

I agree, this will be done automatically on the ansible playbook. Fixed on PR #350 .