Ansible, Juniper CLI commands. Timeout Error?
<p>I am trying to transfer an automation script I made in Python, to ansible (company request), and I have NEVER worked with ansible before. I have tried the "wait_for:", but I have not gotten that to work either. In the script, I could set dev.timeout=None or whatever I needed. I am finding it hard to figure out where I can do this in ansible. I have tried setting the timeout in the "ansible.cfg" file. But that doesnt work. I can do simple commands, like:</p>

<p>cli="show version", or 
cli="show system firmware". </p>

<p>The following is my playbook:</p>

<pre><code>    - hosts: local
  roles:
  - Juniper.junos
  connection: local
  gather_facts: no

  tasks:
  - junos_cli:
      host={{ inventory_hostname }}
      user=root
      passwd=Hardware1
      cli="request system snapshot slice alternate"
      dest="{{ inventory_hostname }}.txt"
</code></pre>

<p>After I run that, around 120 seconds later, I get the following error:</p>

<pre><code>fatal: [192.168.2.254]: FAILED! =&gt; {"changed": false, "failed": true, "module_stderr": "/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py:652: RuntimeWarning: CLI command is for debug use only!\n  warnings.warn(\"CLI command is for debug use only!\", RuntimeWarning)\nTraceback (most recent call last):\n  File \"/home/pkb/.ansible/tmp/ansible-tmp-1457428640.58-63826456311723/junos_cli\", line 2140, in &lt;module&gt;\n    main()\n  File \"/home/pkb/.ansible/tmp/ansible-tmp-1457428640.58-63826456311723/junos_cli\", line 177, in main\n    dev.close()\n  File \"/usr/local/lib/python2.7/dist-packages/jnpr/junos/device.py\", line 504, in close\n    self._conn.close_session()\n  File \"/usr/local/lib/python2.7/dist-packages/ncclient/manager.py\", line 158, in wrapper\n    return self.execute(op_cls, *args, **kwds)\n  File \"/usr/local/lib/python2.7/dist-packages/ncclient/manager.py\", line 228, in execute\n    raise_mode=self._raise_mode).request(*args, **kwds)\n  File \"/usr/local/lib/python2.7/dist-packages/ncclient/operations/session.py\", line 28, in request\n    return self._request(new_ele(\"close-session\"))\n  File \"/usr/local/lib/python2.7/dist-packages/ncclient/operations/rpc.py\", line 342, in _request\n    raise TimeoutExpiredError('ncclient timed out while waiting for an rpc reply.')\nncclient.operations.errors.TimeoutExpiredError: ncclient timed out while waiting for an rpc reply.\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
</code></pre>

<p>I think it is the timeout, I could be wrong. But it is doing my head in that such a simple task is eluding me.</p>