ansible-plugin
ansible-plugin copied to clipboard
Unable to ssh-add private key
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
- Create a project with Ansible node executor and a job
- Launch the job
- See error : Failed: AnsibleError: ERROR: ssh-add returns with non zero code:[/usr/bin/ssh-add, /tmp/rundeck/ansible-runner2936769464804268420id_rsa]
- Connect ssh to Rundeck host
- Try to add the key : ssh-add /tmp/rundeck/ansible-runner2936769464804268420id_rsa
- See error : Error loading key "/tmp/rundeck/ansible-runner2936769464804268420id_rsa": invalid format
- Open the file with vim and convert the file to unix format : set ff=unix and save it
- Try to add the key : ssh-add /tmp/rundeck/ansible-runner2936769464804268420id_rsa
- ssh-agent ask you to type the passphrase
Expected behavior ssh key must be added
Thank you for your support.
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