So, learning Ansible - and following the notes
http://docs.ansible.com/ansible/latest/network/getting_started/first_playbook.html
However, I don't want to use userid/passwd information but ssh_keyfiles
instead. I can ssh to my switch using ssh_keyfiles, however, ansible
idoesn't want to work with my ssh-agent environment?
user@myhost:~$ ssh-agent bash
user@myhost:~$ ssh-add -l
The agent has no identities.
user@myhost:~$ ssh-add
Enter passphrase for /home/user/.ssh/id_rsa:
Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa)
user@myhost:~$ ssh myswitch
Welcome to myswitch
myswitch>exit
Connection to myswitch closed.
user@myhost:~$ ansible -vvvv all -i myswitch, -c network_cli -m ios_facts
-u user
ansible 2.5.1
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/user/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0
20160609]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed myswitch, inventory source with host_list plugin
Loading callback plugin minimal of type stdout, v2.0 from
/usr/lib/python2.7/dist-packages/ansible/plugins/callback/minimal.pyc
META: ran handlers
<myswitch> attempting to start connection
<myswitch> using connection plugin network_cli
<myswitch> local domain socket does not exist, starting it
<myswitch> control socket path is /home/user/.ansible/pc/195cfb7ae7
<myswitch>
The full traceback is:
Traceback (most recent call last):
File "/usr/bin/ansible-connection", line 70, in start
self.connection._connect()
File
"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py",
line 290, in _connect
ssh = self.paramiko_conn._connect()
File
"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/paramiko_ssh.py",
line 240, in _connect
self.ssh = SSH_CONNECTION_CACHE[cache_key] = self._connect_uncached()
File
"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/paramiko_ssh.py",
line 346, in _connect_uncached
raise AnsibleConnectionFailure(msg)
AnsibleConnectionFailure: ssh user@myswitch:22 : Private key file is
encrypted
To connect as a different user, use -u <username>.
myswitch | FAILED! => {
"msg": "ssh user@myswitch:22 : Private key file is encrypted\nTo
connect as a different user, use -u <username>."
}
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/85f56c20-f9d2-467c-88bb-d6d7b2533714%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.