rundeck-plugins / ansible-plugin

Ansible Integration for Rundeck
MIT License
330 stars 100 forks source link

Unable to ssh-add private key #319

Closed rimkov closed 6 months ago

rimkov commented 2 years ago

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

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-runner2936769464804268420idrsa]
  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 commented 2 years ago

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