For anyone going through a similar issue. Using paramiko_ssh helped me 
progess further but i was still facing issues. Then i changed the 
connection to netconf and everything worked smoothly.

On Thursday, May 2, 2019 at 11:51:01 AM UTC+5:30, [email protected] 
wrote:
>
> I was exploring ansible and the first step i tried was getting some 
> information from a router (a virtual gns3 image). 
> I am able to connect to the device using ssh, get into it's cli and run 
> commands normally but not via ansible.
> I ran asnible playbook with -vvvvv option( ansible-playbook -vvvvv 
> test.yml -i inv ) and these were the logs.
>
> ansible-playbook 2.7.10
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = 
> [u'/home/vicky/.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-playbook
>   python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
> Using /etc/ansible/ansible.cfg as config file
> setting up inventory plugins
> /opt/workminuscode/ansiblePractice/try2/inv did not meet host_list 
> requirements, check plugin documentation if this is unexpected
> /opt/workminuscode/ansiblePractice/try2/inv did not meet script 
> requirements, check plugin documentation if this is unexpected
> Parsed /opt/workminuscode/ansiblePractice/try2/inv inventory source with 
> ini plugin
> Loading callback plugin default of type stdout, v2.0 from 
> /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc
>
> PLAYBOOK: test.yml 
> *********************************************************************************************************************************************************************
> 1 plays in test.yml
>
> PLAY [junosdev] 
> ************************************************************************************************************************************************************************
> META: ran handlers
>
> TASK [collect default set of facts and configuration] 
> **********************************************************************************************************************************
> task path: /opt/workminuscode/ansiblePractice/try2/test.yml:5
> <172.16.10.185> attempting to start connection
> <172.16.10.185> using connection plugin network_cli
> <172.16.10.185> local domain socket does not exist, starting it
> <172.16.10.185> control socket path is /home/vicky/.ansible/pc/77de749e3e
> <172.16.10.185> 
> The full traceback is:
> Traceback (most recent call last):
>   File "/usr/bin/ansible-connection", line 106, in start
>     self.connection._connect()
>   File 
> "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py", 
> line 333, in _connect
>     newline=self._terminal.terminal_inital_prompt_newline)
>   File 
> "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py", 
> line 408, in receive
>     data = self._ssh_shell.recv(256)
>   File 
> "/home/vicky/.local/lib/python2.7/site-packages/paramiko/channel.py", line 
> 701, in recv
>     raise socket.timeout()
> timeout
>
> fatal: [172.16.10.185]: FAILED! => {
>     "msg": ""
> }
>     to retry, use: --limit 
> @/opt/workminuscode/ansiblePractice/try2/test.retry
>
> PLAY RECAP 
> *****************************************************************************************************************************************************************************
> 172.16.10.185              : ok=0    changed=0    unreachable=0    
> failed=1   
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------USEFUL
>  
> INFORMATION--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> The device which i am trying to manage is running JUNOS 17.1R1.8 Kernel 
> 64-bit  JNPR-10.3-20170209.344539_build. 
> ansible version: 2.7.10
> python version: 2.7.15rc1
>
> The direcroty structure is 
>
> .
> ├── group_vars
> │   └── junosdev.yml
> ├── inv
> └── test.yml
>
> Here is the playbook (test.ymll)content.
>
> ---
> - hosts: junosdev
>   gather_facts: no
>   tasks:
>    - name: collect default set of facts and configuration
>      junos_facts:
>
>
> content of inv-
>
> [junosdev]
> 172.16.10.185
>
> content of group_vars/junosdev -
>
> ansible_connection: network_cli
> ansible_network_os: junos
> ansible_user: root
> ansible_ssh_pass: "Mind@123"
>
> I have modified few parameters of ansible.cfg file to ease the ssh 
> connection but nothing worked. Here is the content of 
> /etc/ansible/ansible.cfg file.
>
> host_key_checking = False
> log_path = /opt/log/ansible.log
> look_for_keys = False
> host_key_auto_add = True
>
> I have only added the lines which are not a comment in the ansible.cfg 
> file. I am at my wits end here. Any insight would be helpful.
>
>
>
>

-- 
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/53b01e88-87ad-4849-9dc7-bc7fc6447adc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to