SHARE
TWEET

questionBody

a guest May 2nd, 2019 60 in 103 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I was exploring ansible and the first step i tried was getting some information from a router (a virtual gns3 image). When i execute the playbook it just hangs and then fails with no error msg.
  2. <pre>
  3. device os version: JUNOS 17.1R1.8 Kernel 64-bit  JNPR-10.3-20170209.344539_build.
  4. ansible version: 2.7.10
  5. python version: 2.7.15rc1
  6. </pre>
  7. Directory structure:
  8. <pre>
  9. ├── group_vars
  10. │   └── junosdev.yml
  11. ├── inv
  12. ├── test.retry
  13. └── test.yml </pre>
  14. content of inv:
  15. <pre>
  16. [junosdev]
  17. 172.16.10.185
  18. </pre>
  19. content of playbook, test.yml:
  20. <pre>
  21. - hosts: junosdev
  22.   gather_facts: no
  23.   tasks:
  24.    - name: collect default set of facts and configuration
  25.      junos_facts:
  26. </pre>
  27. content of group_vars/junosdev:
  28. <pre>
  29. ansible_connection: network_cli
  30. ansible_network_os: junos
  31. ansible_user: root
  32. ansible_ssh_pass: "Mind@123"
  33. </pre>
  34. configured parameters in ansible.cfg:
  35. <pre>
  36. host_key_checking = False
  37. log_path = /opt/log/ansible.log
  38. look_for_keys = False
  39. host_key_auto_add = True
  40. </pre>
  41. I am able to connect to the device using ssh, get into it's cli and run commands normally but not via ansible.
  42. I ran asnible playbook with -vvvvv option and these were the logs.  
  43. command- ` ansible-playbook -vvvvv test.yml -i inv`  
  44. output-
  45.   <pre>ansible-playbook 2.7.10
  46.   config file = /etc/ansible/ansible.cfg
  47.   configured module search path = [u'/home/vicky/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  48.   ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  49.   executable location = /usr/bin/ansible-playbook
  50.   python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
  51. Using /etc/ansible/ansible.cfg as config file
  52. setting up inventory plugins
  53. /opt/workminuscode/ansiblePractice/try2/inv did not meet host_list requirements, check plugin documentation if this is unexpected
  54. /opt/workminuscode/ansiblePractice/try2/inv did not meet script requirements, check plugin documentation if this is unexpected
  55. Parsed /opt/workminuscode/ansiblePractice/try2/inv inventory source with ini plugin
  56. Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc
  57.  
  58. PLAYBOOK: test.yml *********************************************************************************************************************************************************************
  59. 1 plays in test.yml
  60.  
  61. PLAY [junosdev] ************************************************************************************************************************************************************************
  62. META: ran handlers
  63.  
  64. TASK [collect default set of facts and configuration] **********************************************************************************************************************************
  65. task path: /opt/workminuscode/ansiblePractice/try2/test.yml:5
  66. <172.16.10.185> attempting to start connection
  67. <172.16.10.185> using connection plugin network_cli
  68. <172.16.10.185> local domain socket does not exist, starting it
  69. <172.16.10.185> control socket path is /home/vicky/.ansible/pc/210084b20c
  70. <172.16.10.185>
  71. The full traceback is:
  72. Traceback (most recent call last):
  73.   File "/usr/bin/ansible-connection", line 106, in start
  74.     self.connection._connect()
  75.   File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py", line 333, in _connect
  76.     newline=self._terminal.terminal_inital_prompt_newline)
  77.   File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py", line 408, in receive
  78.     data = self._ssh_shell.recv(256)
  79.   File "/home/vicky/.local/lib/python2.7/site-packages/paramiko/channel.py", line 701, in recv
  80.     raise socket.timeout()
  81. timeout
  82.  
  83. fatal: [172.16.10.185]: FAILED! => {
  84.     "msg": ""
  85. }
  86.     to retry, use: --limit @/opt/workminuscode/ansiblePractice/try2/test.retry
  87.  
  88. PLAY RECAP *****************************************************************************************************************************************************************************
  89. 172.16.10.185              : ok=0    changed=0    unreachable=0    failed=1</pre>
  90.  
  91.  
  92. The logging was enabled via ansible.cfg file using parameter log_path. Here is the log for this command.
  93. <pre>2019-05-02 11:58:58,802 p=7595 u=vicky |  ansible-playbook 2.7.10
  94.   config file = /etc/ansible/ansible.cfg
  95.   configured module search path = [u&apos;/home/vicky/.ansible/plugins/modules&apos;, u&apos;/usr/share/ansible/plugins/modules&apos;]
  96.   ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  97.   executable location = /usr/bin/ansible-playbook
  98.   python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
  99. 2019-05-02 11:58:58,802 p=7595 u=vicky |  Using /etc/ansible/ansible.cfg as config file
  100. 2019-05-02 11:58:58,802 p=7595 u=vicky |  setting up inventory plugins
  101. 2019-05-02 11:58:58,836 p=7595 u=vicky |  /opt/workminuscode/ansiblePractice/try2/inv did not meet host_list requirements, check plugin documentation if this is unexpected
  102. 2019-05-02 11:58:58,836 p=7595 u=vicky |  /opt/workminuscode/ansiblePractice/try2/inv did not meet script requirements, check plugin documentation if this is unexpected
  103. 2019-05-02 11:58:58,839 p=7595 u=vicky |  Parsed /opt/workminuscode/ansiblePractice/try2/inv inventory source with ini plugin
  104. 2019-05-02 11:58:58,916 p=7595 u=vicky |  Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc
  105. 2019-05-02 11:58:58,995 p=7595 u=vicky |  PLAYBOOK: test.yml *********************************************************************************************************************************************************************
  106. 2019-05-02 11:58:58,996 p=7595 u=vicky |  1 plays in test.yml
  107. 2019-05-02 11:58:59,006 p=7595 u=vicky |  PLAY [junosdev] ************************************************************************************************************************************************************************
  108. 2019-05-02 11:58:59,010 p=7595 u=vicky |  META: ran handlers
  109. 2019-05-02 11:58:59,018 p=7595 u=vicky |  TASK [collect default set of facts and configuration] **********************************************************************************************************************************
  110. 2019-05-02 11:58:59,019 p=7595 u=vicky |  task path: /opt/workminuscode/ansiblePractice/try2/test.yml:5
  111. 2019-05-02 11:58:59,384 p=7603 u=vicky |  network_os is set to junos
  112. 2019-05-02 11:58:59,419 p=7610 u=vicky | paramiko [172.16.10.185] starting thread (client mode): 0x1b8acbd0L
  113. 2019-05-02 11:58:59,419 p=7610 u=vicky | paramiko [172.16.10.185] Local version/idstring: SSH-2.0-paramiko_2.4.2
  114. 2019-05-02 11:58:59,435 p=7610 u=vicky | paramiko [172.16.10.185] Remote version/idstring: SSH-2.0-OpenSSH_6.6.1
  115. 2019-05-02 11:58:59,435 p=7610 u=vicky | paramiko [172.16.10.185] Connected (version 2.0, client OpenSSH_6.6.1)
  116. 2019-05-02 11:58:59,443 p=7610 u=vicky | paramiko [172.16.10.185] kex algos:[u&apos;curve25519-sha256@libssh.org&apos;, u&apos;ecdh-sha2-nistp256&apos;, u&apos;ecdh-sha2-nistp384&apos;, u&apos;ecdh-sha2-nistp521&apos;, u&apos;diffie-hellman-group-exchange-sha256&apos;, u&apos;diffie-hellman-group-exchange-sha1&apos;, u&apos;diffie-hellman-group14-sha1&apos;, u&apos;diffie-hellman-group1-sha1&apos;] server key:[u&apos;ssh-rsa&apos;, u&apos;ssh-dss&apos;, u&apos;ecdsa-sha2-nistp256&apos;, u&apos;ssh-ed25519&apos;] client encrypt:[u&apos;aes128-ctr&apos;, u&apos;aes192-ctr&apos;, u&apos;aes256-ctr&apos;, u&apos;arcfour256&apos;, u&apos;arcfour128&apos;, u&apos;aes128-gcm@openssh.com&apos;, u&apos;aes256-gcm@openssh.com&apos;, u&apos;chacha20-poly1305@openssh.com&apos;, u&apos;aes128-cbc&apos;, u&apos;3des-cbc&apos;, u&apos;blowfish-cbc&apos;, u&apos;cast128-cbc&apos;, u&apos;aes192-cbc&apos;, u&apos;aes256-cbc&apos;, u&apos;arcfour&apos;, u&apos;rijndael-cbc@lysator.liu.se&apos;] server encrypt:[u&apos;aes128-ctr&apos;, u&apos;aes192-ctr&apos;, u&apos;aes256-ctr&apos;, u&apos;arcfour256&apos;, u&apos;arcfour128&apos;, u&apos;aes128-gcm@openssh.com&apos;, u&apos;aes256-gcm@openssh.com&apos;, u&apos;chacha20-poly1305@openssh.com&apos;, u&apos;aes128-cbc&apos;, u&apos;3des-cbc&apos;, u&apos;blowfish-cbc&apos;, u&apos;cast128-cbc&apos;, u&apos;aes192-cbc&apos;, u&apos;aes256-cbc&apos;, u&apos;arcfour&apos;, u&apos;rijndael-cbc@lysator.liu.se&apos;] client mac:[u&apos;hmac-md5-etm@openssh.com&apos;, u&apos;hmac-sha1-etm@openssh.com&apos;, u&apos;umac-64-etm@openssh.com&apos;, u&apos;umac-128-etm@openssh.com&apos;, u&apos;hmac-sha2-256-etm@openssh.com&apos;, u&apos;hmac-sha2-512-etm@openssh.com&apos;, u&apos;hmac-ripemd160-etm@openssh.com&apos;, u&apos;hmac-sha1-96-etm@openssh.com&apos;, u&apos;hmac-md5-96-etm@openssh.com&apos;, u&apos;hmac-md5&apos;, u&apos;hmac-sha1&apos;, u&apos;umac-64@openssh.com&apos;, u&apos;umac-128@openssh.com&apos;, u&apos;hmac-sha2-256&apos;, u&apos;hmac-sha2-256-96&apos;, u&apos;hmac-sha2-512&apos;, u&apos;hmac-sha2-512-96&apos;, u&apos;hmac-ripemd160&apos;, u&apos;hmac-ripemd160@openssh.com&apos;, u&apos;hmac-sha1-96&apos;, u&apos;hmac-md5-96&apos;] server mac:[u&apos;hmac-md5-etm@openssh.com&apos;, u&apos;hmac-sha1-etm@openssh.com&apos;, u&apos;umac-64-etm@openssh.com&apos;, u&apos;umac-128-etm@openssh.com&apos;, u&apos;hmac-sha2-256-etm@openssh.com&apos;, u&apos;hmac-sha2-512-etm@openssh.com&apos;, u&apos;hmac-ripemd160-etm@openssh.com&apos;, u&apos;hmac-sha1-96-etm@openssh.com&apos;, u&apos;hmac-md5-96-etm@openssh.com&apos;, u&apos;hmac-md5&apos;, u&apos;hmac-sha1&apos;, u&apos;umac-64@openssh.com&apos;, u&apos;umac-128@openssh.com&apos;, u&apos;hmac-sha2-256&apos;, u&apos;hmac-sha2-256-96&apos;, u&apos;hmac-sha2-512&apos;, u&apos;hmac-sha2-512-96&apos;, u&apos;hmac-ripemd160&apos;, u&apos;hmac-ripemd160@openssh.com&apos;, u&apos;hmac-sha1-96&apos;, u&apos;hmac-md5-96&apos;] client compress:[u&apos;none&apos;, u&apos;zlib@openssh.com&apos;] server compress:[u&apos;none&apos;, u&apos;zlib@openssh.com&apos;] client lang:[u&apos;&apos;] server lang:[u&apos;&apos;] kex follows?False
  117. 2019-05-02 11:58:59,444 p=7610 u=vicky | paramiko [172.16.10.185] Kex agreed: ecdh-sha2-nistp256
  118. 2019-05-02 11:58:59,444 p=7610 u=vicky | paramiko [172.16.10.185] HostKey agreed: ssh-ed25519
  119. 2019-05-02 11:58:59,444 p=7610 u=vicky | paramiko [172.16.10.185] Cipher agreed: aes128-ctr
  120. 2019-05-02 11:58:59,445 p=7610 u=vicky | paramiko [172.16.10.185] MAC agreed: hmac-sha2-256
  121. 2019-05-02 11:58:59,447 p=7610 u=vicky | paramiko [172.16.10.185] Compression agreed: none
  122. 2019-05-02 11:58:59,462 p=7610 u=vicky | paramiko [172.16.10.185] kex engine KexNistp256 specified hash_algo &lt;built-in function openssl_sha256&gt;
  123. 2019-05-02 11:58:59,462 p=7610 u=vicky | paramiko [172.16.10.185] Switch to new keys ...
  124. 2019-05-02 11:58:59,567 p=7610 u=vicky | paramiko [172.16.10.185] userauth is OK
  125. 2019-05-02 11:58:59,610 p=7610 u=vicky | paramiko [172.16.10.185] Authentication (password) successful!
  126. 2019-05-02 11:58:59,615 p=7610 u=vicky | paramiko [172.16.10.185] [chan 0] Max packet in: 32768 bytes
  127. 2019-05-02 11:58:59,618 p=7610 u=vicky | paramiko [172.16.10.185] [chan 0] Max packet out: 32768 bytes
  128. 2019-05-02 11:58:59,618 p=7610 u=vicky | paramiko [172.16.10.185] Secsh channel 0 opened.
  129. 2019-05-02 11:58:59,624 p=7610 u=vicky | paramiko [172.16.10.185] [chan 0] Sesch channel 0 request ok
  130. 2019-05-02 11:58:59,631 p=7610 u=vicky | paramiko [172.16.10.185] [chan 0] Sesch channel 0 request ok
  131. 2019-05-02 11:59:09,739 p=7595 u=vicky |  The full traceback is:
  132. Traceback (most recent call last):
  133.   File &quot;/usr/bin/ansible-connection&quot;, line 106, in start
  134.     self.connection._connect()
  135.   File &quot;/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py&quot;, line 333, in _connect
  136.     newline=self._terminal.terminal_inital_prompt_newline)
  137.   File &quot;/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py&quot;, line 408, in receive
  138.     data = self._ssh_shell.recv(256)
  139.   File &quot;/home/vicky/.local/lib/python2.7/site-packages/paramiko/channel.py&quot;, line 701, in recv
  140.     raise socket.timeout()
  141. timeout
  142.  
  143. 2019-05-02 11:59:09,741 p=7595 u=vicky |  fatal: [172.16.10.185]: FAILED! =&gt; {
  144.     &quot;msg&quot;: &quot;&quot;
  145. }
  146. 2019-05-02 11:59:09,742 p=7595 u=vicky |    to retry, use: --limit @/opt/workminuscode/ansiblePractice/try2/test.retry
  147.  
  148. 2019-05-02 11:59:09,742 p=7595 u=vicky |  PLAY RECAP *****************************************************************************************************************************************************************************
  149. 2019-05-02 11:59:09,742 p=7595 u=vicky |  172.16.10.185              : ok=0    changed=0    unreachable=0    failed=1  
  150. 2019-05-02 11:59:09,808 p=7603 u=vicky |  shutdown complete
  151. 2019-05-02 11:59:09,811 p=7610 u=vicky | paramiko [172.16.10.185] EOF in transport thread</pre>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top