rundeck / rundeck

Enable Self-Service Operations: Give specific users access to your existing tools, services, and scripts
http://rundeck.org
Apache License 2.0
5.51k stars 915 forks source link

Ansible inventory, Rundeck cannot connect to node #8927

Closed hanserasmus closed 7 months ago

hanserasmus commented 7 months ago

Note: Bug Reports not following this template may be closed without feedback.

Getting Help Please use this issue template for reporting identified or suspected bugs only. For support on configuration or troubleshooting please see Getting Help for the appropriate channels.

Describe the bug When trying to set up an Ansible inventory with ssh key (no passphrase), I keep getting an error in my rundeck logs:

fatal: [dev-ubuntu.my.domain]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Load key \"/tmp/rundeck/ansible-runner4638317308961054090id_rsa\": error in libcrypto\r\nroot@dev-ubuntu.my.domain: Permission denied (publickey).", "unreachable": true}

But when I test Ansible via cli, using the same key, just saved in the correct space, it works:

root@rundeck:/opt# ansible ced_ubuntu -i test_inventories/ced.ini -m ping -v
No config file found; using defaults
dev-ubuntu.my.domain | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}

My Rundeck detail

To Reproduce Steps to reproduce the behavior:

  1. Go to Edit Nodes in the project, add ansible inventory location, under SSH settings add a previously added SSH key.
  2. Click on Nodes and check your logs, you will find an error like the one mentioned above.

Expected behavior I expect Rundeck to connect to the remote node and add it under the Nodes page.

Screenshots image

image

image

Desktop (please complete the following information):

What am I doing wrong?

EDIT: I should add I have tried using it as the admin user, and the admin user has full ACL permissions on all keys.

hanserasmus commented 7 months ago

For anyone else finding this: The issue was I was uploading an OpenSSH key, rather than an RSA key. I fixed it by first converting the key with ssh-keygen -p -m PEM -f ./privkey and then uploading the key again.

Next up I ran into an issue as described in #7766 and found my answer in this comment. Changing my executors to SSHJ fixed all my problems.