title: ios_command: Connection type ssh is not valid for this module
body: <p>Ansible <code>raw</code> command can work via SSH, but this playbook cannot work with the same Cisco command <code>show version</code>.</p>
  <p>It is giving this error message, related to SSH:</p>
  <blockquote>
  <p>fatal: [192.168.1.15]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Connection type ssh is not valid for this module&quot;}</p>
  </blockquote>
  <p>Here is the inventory under <em>inventory/host-file</em></p>
  <pre><code>[routers]
  192.168.1.15
  [routers:vars]
  
  ansible_network_os=ios
  ansible_user=admin
  ansible_password=admin
  ansible_connection=network_cli
  </code></pre>
  <p>And the playbook <em>playbooks/show_version.yml</em></p>
  <pre class="lang-yaml prettyprint-override"><code>---
      
  - name: Cisco show version example
    hosts: routers
    gather_facts: false
  
    tasks:
      - name: run show version on the routers
        ios_command:
          commands: show version | incl Version
        register: output
  
      - name: print output
        debug:
          var: output.stdout_lines
  </code></pre>
  <p>Here is my file structure</p>
  <pre class="lang-none prettyprint-override"><code>.
  ├── ansible.cfg
  ├── hosts
  ├── inventory
  │   └── host-file
  └── playbooks
      └── show_version.yml
  </code></pre>
  <p>I do run the playbook with the command below, from the folder <em>playbooks</em></p>
  <pre class="lang-sh prettyprint-override"><code>ansible-playbook show_version.yml
  </code></pre>
  <p>Is this a SSH issue?<br />
  Can anyone share some experience?</p>