ansible-plugin icon indicating copy to clipboard operation
ansible-plugin copied to clipboard

Unable to ssh-add private key

Open rimkov opened this issue 2 years ago • 1 comments

Describe the bug I have installed Ansible on my Rundeck host, ansible inventory is working fine but i'm unable to connect to node with protected ssh key. On my nodes i have an ansible user and i'm using a passphrase protected private key.

I added the key on my project key storage and i configured Ansible Ad-Hoc Node executor like this :

Executable : /bin/bash Ansible config path : /etc/ansible/ansible.cfg SSH authentication : privateKey SSH user : ansible SSH key file path : keys/project/test SSH key storage path : keys/project/test/ansible_rsa Use ssh-agent : YES SSH passphrase : keys/project/test/ansible_pass SSH Passphrase from secure option : option.sshKeyPassphrase Use become privilege escalation : YES

Here is my framework.properties : framework.ssh.keypath = /var/lib/rundeck/.ssh/ansible_rsa framework.ssh.user = ansible

My Rundeck detail

  • Rundeck version: 4.3.1
  • install type: deb
  • OS Name/version: Ubuntu 20.04
  • DB Type/version: default
  • Ansible version : tried with 2.9.6 and 2.12.6

To Reproduce

  1. Create a project with Ansible node executor and a job
  2. Launch the job
  3. See error : Failed: AnsibleError: ERROR: ssh-add returns with non zero code:[/usr/bin/ssh-add, /tmp/rundeck/ansible-runner2936769464804268420id_rsa]
  4. Connect ssh to Rundeck host
  5. Try to add the key : ssh-add /tmp/rundeck/ansible-runner2936769464804268420id_rsa
  6. See error : Error loading key "/tmp/rundeck/ansible-runner2936769464804268420id_rsa": invalid format
  7. Open the file with vim and convert the file to unix format : set ff=unix and save it
  8. Try to add the key : ssh-add /tmp/rundeck/ansible-runner2936769464804268420id_rsa
  9. ssh-agent ask you to type the passphrase

Expected behavior ssh key must be added

Thank you for your support.

rimkov avatar Jun 21 '22 12:06 rimkov

if i replace SSH key file path : keys/project/test by SSH key file path : /var/lib/rundeck/.ssh/ansible_rsa and empty SSH key storage path everything is working

rimkov avatar Jun 22 '22 07:06 rimkov