<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ios_command</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto"><strong>Both latest unstable</strong> versions:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.2.0 (detached HEAD 7424e1c417) last updated 2017/06/28 14:37:25 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

ansible 2.4.0 (devel a5b905c941) last updated 2017/06/28 15:03:00 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
  ansible python module location = /home/actionmystique/src/Ansible/git-ansible/lib/ansible
  executable location = /home/actionmystique/src/Ansible/git-ansible/bin/ansible
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]"><pre class="notranslate"><code class="notranslate">ansible 2.3.2.0 (detached HEAD 7424e1c417) last updated 2017/06/28 14:37:25 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]

ansible 2.4.0 (devel a5b905c941) last updated 2017/06/28 15:03:00 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/actionmystique/Ansible/git-yang-networkop/ansible-101/library']
  ansible python module location = /home/actionmystique/src/Ansible/git-ansible/lib/ansible
  executable location = /home/actionmystique/src/Ansible/git-ansible/bin/ansible
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">inventory   = ./hosts<br>
library        = /home/actionmystique/Ansible/git-yang-networkop/ansible-101/library<br>
forks = 1000<br>
gathering = explicit<br>
gather_timeout = 30<br>
roles_path = /home/actionmystique/Ansible/Roles/roles<br>
private_role_vars = yes<br>
hash_behaviour = merge<br>
log_path = /var/log/ansible.log<br>
retry_files_enabled = False<br>
show_custom_stats = True<br>
timeout = 60<br>
pipelining = True<br>
connect_timeout = 60<br>
connect_retries = 30<br>
connect_interval = 1</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<ul dir="auto">
<li>host: <strong>Ubuntu 17.04 4.10</strong></li>
<li>target: <strong>IOS-XEv 16.5.1</strong></li>
<li><strong>paramiko: 2.0.6</strong></li>
</ul>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">The generic {{ undefined_variable | default(defined_variable) }} does not work inside a dictionary, when the target hostnames are defined in /etc/hosts.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Hostnames statically defined in /etc/hosts:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="172.21.100.111 XEv_Spine_11.actionmystique.net XEv_Spine_11
172.21.100.112 XEv_Spine_12.actionmystique.net XEv_Spine_12"><pre class="notranslate"><code class="notranslate">172.21.100.111 XEv_Spine_11.actionmystique.net XEv_Spine_11
172.21.100.112 XEv_Spine_12.actionmystique.net XEv_Spine_12
</code></pre></div>
<p dir="auto">Structure passed as "<strong>provider</strong>": connections.ssh (the arrow is absent from the original dictionary)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="connections
...
        ssh:
          transport: cli 
---------&gt;host: &quot;{{ ansible_host | default(inventory_hostname) }}&quot;
          # ansible_port
          port: 22
          # ansible_user
          username: admin
          # ansible_ssh_pass
          password: xxxxxxxxxxx
          authorize: yes
          # enable_secret_password
          auth_pass: xxxxxxxxxxx
          # private_key_file
          ssh_keyfile: &quot;~/.ssh/id_rsa&quot;
          version: 2
          timeout: 10"><pre class="notranslate"><code class="notranslate">connections
...
        ssh:
          transport: cli 
---------&gt;host: "{{ ansible_host | default(inventory_hostname) }}"
          # ansible_port
          port: 22
          # ansible_user
          username: admin
          # ansible_ssh_pass
          password: xxxxxxxxxxx
          authorize: yes
          # enable_secret_password
          auth_pass: xxxxxxxxxxx
          # private_key_file
          ssh_keyfile: "~/.ssh/id_rsa"
          version: 2
          timeout: 10
</code></pre></div>
<p dir="auto"><strong>Role</strong>: ios_pull_config:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- include_vars: &quot;../defaults/{{ os_family }}/connections.yml&quot;
  when: (connections is undefined)
...
- name: Fetching config from the remote node
  ios_command:
        provider: &quot;{{ connections.ssh }}&quot;
        commands:
          - &quot;show {{ config }}&quot;
  register: configuration"><pre class="notranslate"><code class="notranslate">- include_vars: "../defaults/{{ os_family }}/connections.yml"
  when: (connections is undefined)
...
- name: Fetching config from the remote node
  ios_command:
        provider: "{{ connections.ssh }}"
        commands:
          - "show {{ config }}"
  register: configuration
</code></pre></div>
<p dir="auto"><strong>Playbook</strong>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: Pulling IOS/IOSv/IOSv-L2/IOS-XE/IOS-XEv (CSR-1000v) startup and running configs
  hosts:
    - iosv
    - ios_xev
    - iosv_l2
    - ios_xev
  gather_facts: no
  roles:
    - { role: ios_pull_config, config: startup-config, with_date_time: 'no' }
    - { role: ios_pull_config, config: running-config, with_date_time: 'no' }"><pre class="notranslate"><code class="notranslate">- name: Pulling IOS/IOSv/IOSv-L2/IOS-XE/IOS-XEv (CSR-1000v) startup and running configs
  hosts:
    - iosv
    - ios_xev
    - iosv_l2
    - ios_xev
  gather_facts: no
  roles:
    - { role: ios_pull_config, config: startup-config, with_date_time: 'no' }
    - { role: ios_pull_config, config: running-config, with_date_time: 'no' }
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">startup and running configurations should be pulled from the target nodes.</p>
<h5 dir="auto">ACTUAL RESULTS: Log</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="...
2017-06-29 10:00:34,575 paramiko.transport starting thread (client mode): 0xf6b6c110L
2017-06-29 10:00:34,576 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.0.6
2017-06-29 10:00:34,577 paramiko.transport Remote version/idstring: SSH-2.0-Cisco-1.25
2017-06-29 10:00:34,577 paramiko.transport Connected (version 2.0, client Cisco-1.25)
2017-06-29 10:00:34,577 paramiko.transport kex algos:[u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1'] server key:[u'ssh-rsa'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr'] client mac:[u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none'] server compress:[u'none'] client lang:[u''] server lang:[u''] kex follows?False
2017-06-29 10:00:34,577 paramiko.transport Kex agreed: diffie-hellman-group14-sha1
2017-06-29 10:00:34,578 paramiko.transport Cipher agreed: aes128-ctr
2017-06-29 10:00:34,578 paramiko.transport MAC agreed: hmac-sha2-256
2017-06-29 10:00:34,578 paramiko.transport Compression agreed: none
2017-06-29 10:00:34,818 paramiko.transport kex engine KexGroup14 specified hash_algo &lt;built-in function openssl_sha1&gt;
2017-06-29 10:00:34,818 paramiko.transport Switch to new keys ...
2017-06-29 10:00:34,851 p=16072 u=root |  connecting to host XEv_Spine_11 returned an error
2017-06-29 10:00:34,851 p=16072 u=root |  (14, 'Bad address')
2017-06-29 10:00:34,919 paramiko.transport EOF in transport thread
2017-06-29 10:01:04,470 p=16072 u=root |  number of connection attempts exceeded, unable to connect to control socket
2017-06-29 10:01:04,471 p=16072 u=root |  persistent_connect_interval=1, persistent_connect_retries=30
2017-06-29 10:01:04,491 p=15970 u=root |  open_shell() returned 255  failed to connect to control socket
2017-06-29 10:01:04,493 p=15970 u=root |  fatal: [XEv_Spine_11]: FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;msg&quot;: &quot;unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell&quot;, 
    &quot;rc&quot;: 255
}
..."><pre class="notranslate"><code class="notranslate">...
2017-06-29 10:00:34,575 paramiko.transport starting thread (client mode): 0xf6b6c110L
2017-06-29 10:00:34,576 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.0.6
2017-06-29 10:00:34,577 paramiko.transport Remote version/idstring: SSH-2.0-Cisco-1.25
2017-06-29 10:00:34,577 paramiko.transport Connected (version 2.0, client Cisco-1.25)
2017-06-29 10:00:34,577 paramiko.transport kex algos:[u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1'] server key:[u'ssh-rsa'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr'] client mac:[u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha2-256', u'hmac-sha2-512', u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none'] server compress:[u'none'] client lang:[u''] server lang:[u''] kex follows?False
2017-06-29 10:00:34,577 paramiko.transport Kex agreed: diffie-hellman-group14-sha1
2017-06-29 10:00:34,578 paramiko.transport Cipher agreed: aes128-ctr
2017-06-29 10:00:34,578 paramiko.transport MAC agreed: hmac-sha2-256
2017-06-29 10:00:34,578 paramiko.transport Compression agreed: none
2017-06-29 10:00:34,818 paramiko.transport kex engine KexGroup14 specified hash_algo &lt;built-in function openssl_sha1&gt;
2017-06-29 10:00:34,818 paramiko.transport Switch to new keys ...
2017-06-29 10:00:34,851 p=16072 u=root |  connecting to host XEv_Spine_11 returned an error
2017-06-29 10:00:34,851 p=16072 u=root |  (14, 'Bad address')
2017-06-29 10:00:34,919 paramiko.transport EOF in transport thread
2017-06-29 10:01:04,470 p=16072 u=root |  number of connection attempts exceeded, unable to connect to control socket
2017-06-29 10:01:04,471 p=16072 u=root |  persistent_connect_interval=1, persistent_connect_retries=30
2017-06-29 10:01:04,491 p=15970 u=root |  open_shell() returned 255  failed to connect to control socket
2017-06-29 10:01:04,493 p=15970 u=root |  fatal: [XEv_Spine_11]: FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "msg": "unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell", 
    "rc": 255
}
...
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS: Successful Manual SSH with inventory_hostname content</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# ssh admin@XEv_Spine_11
CC
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************CC
XEv_Spine_11# #sh ver
Cisco IOS XE Software, Version 16.05.01b
Cisco IOS Software [Everest], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.5.1b, RELEASE SOFTWARE (fc1)
..."><pre class="notranslate"><code class="notranslate"># ssh admin@XEv_Spine_11
CC
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************CC
XEv_Spine_11# #sh ver
Cisco IOS XE Software, Version 16.05.01b
Cisco IOS Software [Everest], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.5.1b, RELEASE SOFTWARE (fc1)
...
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">ios_command<br>
ios_config</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /mnt/c/jv/Ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /mnt/c/jv/Ansible/ansible.cfg
  configured module search path = [u'/etc/ansible/library']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Windows Subsystem Linux &amp; Ubuntu 16.04.3</p>
<p dir="auto">No LSB modules are available.<br>
Distributor ID: Ubuntu<br>
Description:    Ubuntu 14.04.5 LTS<br>
Release:        14.04<br>
Codename:       trusty</p>
<p dir="auto">No LSB modules are available.<br>
Distributor ID: Ubuntu<br>
Description:    Ubuntu 16.04.3 LTS<br>
Release:        16.04<br>
Codename:       xenial</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">In my inventory file I have the following:</p>
<p dir="auto">[switches]<br>
COMSW0001<br>
comsw0002</p>
<p dir="auto">ios_command &amp; ios_config connect just fine when the characters are all lower case. When they are all upper case Ansible is unable to connect to host. If I swap the upper/lower case around, the issue follows the upper case host.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
# Ansible playbook to copy and change the boot statement on a Cisco IOS switch
# Leverages NTC-Ansible: https://github.com/networktocode/ntc-ansible
# Requires Python PyNTC
- name: Copy code to machine and change boot statement
  connection: local
  hosts: switches
  gather_facts: no
  serial:
    - 5%
    - 10%
    - 30%
  vars_files:
    - /path/to/cred/file
  vars:
    cli:
      username: &quot;{{ u }}&quot;
      password: &quot;{{ p }}&quot;

    code_version:
      WS-C3560CX-8PC-S: c3560cx-universalk9-mz.152-4.E4.bin
      WS-C3560C-8PC-S: c3560c405-universalk9-mz.152-2.E7.bin
      WS-C3560CG-8PC-S: c3560c405-universalk9-mz.152-2.E7.bin
      WS-C3560C-12PC-S: c3560c405-universalk9-mz.152-2.E7.bin

  tasks:
    - name: Determine OS Version
      ntc_show_command:
        connection: ssh
        platform: cisco_ios_ssh
        command: show version
        template_dir: &quot;/etc/ansible/library/ntc-ansible/ntc-templates/templates&quot;
        host: &quot;{{ inventory_hostname }}&quot;
        username: &quot;{{ u }}&quot;
        password: &quot;{{ p }}&quot;
        secret: &quot;{{ p }}&quot;
      register: ntc_result

    - name: Debug NTC
      debug:
        msg: &quot;{{ ntc_result }}&quot;

    - name: Get SNMP information
      ios_command:
        provider: &quot;{{ cli }}&quot;
        commands:
          - show ip int brief
        timeout: 40
      register: run_config

    - name: Get the details
      set_fact:
        output: &quot;{{ run_config.stdout_lines[0] }}&quot;

    - name: Verify SCP is configured
      ios_config:
        provider: &quot;{{ cli }}&quot;
        lines:
          - ip scp server enable


    - name: Copy File
      ntc_file_copy:
        local_file: images/{{ code_version[ntc_result['response'][0]['hardware'][0]] }}
        platform: cisco_ios_ssh
        username: &quot;{{ u }}&quot;
        password: &quot;{{ p }}&quot;
        host: &quot;{{ inventory_hostname }}&quot;
      register: output"><pre class="notranslate">---
<span class="pl-c"><span class="pl-c">#</span> Ansible playbook to copy and change the boot statement on a Cisco IOS switch</span>
<span class="pl-c"><span class="pl-c">#</span> Leverages NTC-Ansible: https://github.com/networktocode/ntc-ansible</span>
<span class="pl-c"><span class="pl-c">#</span> Requires Python PyNTC</span>
- <span class="pl-ent">name</span>: <span class="pl-s">Copy code to machine and change boot statement</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">hosts</span>: <span class="pl-s">switches</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-s">no</span>
  <span class="pl-ent">serial</span>:
    - <span class="pl-c1">5%</span>
    - <span class="pl-c1">10%</span>
    - <span class="pl-c1">30%</span>
  <span class="pl-ent">vars_files</span>:
    - <span class="pl-s">/path/to/cred/file</span>
  <span class="pl-ent">vars</span>:
    <span class="pl-ent">cli</span>:
      <span class="pl-ent">username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ u }}<span class="pl-pds">"</span></span>
      <span class="pl-ent">password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ p }}<span class="pl-pds">"</span></span>

    <span class="pl-ent">code_version</span>:
      <span class="pl-ent">WS-C3560CX-8PC-S</span>: <span class="pl-s">c3560cx-universalk9-mz.152-4.E4.bin</span>
      <span class="pl-ent">WS-C3560C-8PC-S</span>: <span class="pl-s">c3560c405-universalk9-mz.152-2.E7.bin</span>
      <span class="pl-ent">WS-C3560CG-8PC-S</span>: <span class="pl-s">c3560c405-universalk9-mz.152-2.E7.bin</span>
      <span class="pl-ent">WS-C3560C-12PC-S</span>: <span class="pl-s">c3560c405-universalk9-mz.152-2.E7.bin</span>

  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">name</span>: <span class="pl-s">Determine OS Version</span>
      <span class="pl-ent">ntc_show_command</span>:
        <span class="pl-ent">connection</span>: <span class="pl-s">ssh</span>
        <span class="pl-ent">platform</span>: <span class="pl-s">cisco_ios_ssh</span>
        <span class="pl-ent">command</span>: <span class="pl-s">show version</span>
        <span class="pl-ent">template_dir</span>: <span class="pl-s"><span class="pl-pds">"</span>/etc/ansible/library/ntc-ansible/ntc-templates/templates<span class="pl-pds">"</span></span>
        <span class="pl-ent">host</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ inventory_hostname }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ u }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ p }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">secret</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ p }}<span class="pl-pds">"</span></span>
      <span class="pl-ent">register</span>: <span class="pl-s">ntc_result</span>

    - <span class="pl-ent">name</span>: <span class="pl-s">Debug NTC</span>
      <span class="pl-ent">debug</span>:
        <span class="pl-ent">msg</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ ntc_result }}<span class="pl-pds">"</span></span>

    - <span class="pl-ent">name</span>: <span class="pl-s">Get SNMP information</span>
      <span class="pl-ent">ios_command</span>:
        <span class="pl-ent">provider</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ cli }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">commands</span>:
          - <span class="pl-s">show ip int brief</span>
        <span class="pl-ent">timeout</span>: <span class="pl-c1">40</span>
      <span class="pl-ent">register</span>: <span class="pl-s">run_config</span>

    - <span class="pl-ent">name</span>: <span class="pl-s">Get the details</span>
      <span class="pl-ent">set_fact</span>:
        <span class="pl-ent">output</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ run_config.stdout_lines[0] }}<span class="pl-pds">"</span></span>

    - <span class="pl-ent">name</span>: <span class="pl-s">Verify SCP is configured</span>
      <span class="pl-ent">ios_config</span>:
        <span class="pl-ent">provider</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ cli }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">lines</span>:
          - <span class="pl-s">ip scp server enable</span>


    - <span class="pl-ent">name</span>: <span class="pl-s">Copy File</span>
      <span class="pl-ent">ntc_file_copy</span>:
        <span class="pl-ent">local_file</span>: <span class="pl-s">images/{{ code_version[ntc_result['response'][0]['hardware'][0]] }}</span>
        <span class="pl-ent">platform</span>: <span class="pl-s">cisco_ios_ssh</span>
        <span class="pl-ent">username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ u }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ p }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">host</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ inventory_hostname }}<span class="pl-pds">"</span></span>
      <span class="pl-ent">register</span>: <span class="pl-s">output</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">First task connects fine and works.<br>
Tasks with ios_* fail to connect.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Failed to connect on the ios_* - I do have the log file. Looks to be an Invalid Argument</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2017-11-02 16:03:24,692 p=7253 u=joshv |    7262 1509656604.69279: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py
  7262 1509656604.69401: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found_in_cache=True, class_only=False)
2017-11-02 16:03:24,694 p=7253 u=joshv |    7262 1509656604.69401: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found_in_cache=True, class_only=False)
  7262 1509656604.69887: assigned :doc
2017-11-02 16:03:24,699 p=7253 u=joshv |    7262 1509656604.69887: assigned :doc
  7262 1509656604.69952: Loaded config def from plugin (connection/network_cli)
2017-11-02 16:03:24,699 p=7253 u=joshv |    7262 1509656604.69952: Loaded config def from plugin (connection/network_cli)
2017-11-02 16:03:24,786 paramiko.transport starting thread (client mode): 0x742ed150L
2017-11-02 16:03:24,786 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.3.1
2017-11-02 16:03:24,787 paramiko.transport Remote version/idstring: SSH-2.0-Cisco-1.25
2017-11-02 16:03:24,787 paramiko.transport Connected (version 2.0, client Cisco-1.25)
2017-11-02 16:03:24,795 paramiko.transport kex algos:[u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-cbc', u'3des-cbc', u'aes192-cbc', u'aes256-cbc'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-cbc', u'3des-cbc', u'aes192-cbc', u'aes256-cbc'] client mac:[u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none'] server compress:[u'none'] client lang:[u''] server lang:[u''] kex follows?False
2017-11-02 16:03:24,796 paramiko.transport Kex agreed: diffie-hellman-group-exchange-sha1
2017-11-02 16:03:24,796 paramiko.transport HostKey agreed: ssh-rsa
2017-11-02 16:03:24,796 paramiko.transport Cipher agreed: aes128-ctr
2017-11-02 16:03:24,796 paramiko.transport MAC agreed: hmac-sha1
2017-11-02 16:03:24,796 paramiko.transport Compression agreed: none
2017-11-02 16:03:24,807 paramiko.transport Got server p (2048 bits)
2017-11-02 16:03:25,075 paramiko.transport kex engine KexGex specified hash_algo &lt;built-in function openssl_sha1&gt;
2017-11-02 16:03:25,076 paramiko.transport Switch to new keys ...
2017-11-02 16:03:25,090 p=7253 u=joshv |  connecting to host SYCOMSW0002 returned an error
2017-11-02 16:03:25,090 p=7253 u=joshv |  (22, 'Invalid argument')
2017-11-02 16:03:25,177 paramiko.transport EOF in transport thread
2017-11-02 16:04:04,477 p=7211 u=joshv |    7252 1509656644.47682: handler run complete
2017-11-02 16:04:04,478 p=7211 u=joshv |    7252 1509656644.47803: attempt loop complete, returning result
2017-11-02 16:04:04,478 p=7211 u=joshv |    7252 1509656644.47853: _execute() done
2017-11-02 16:04:04,479 p=7211 u=joshv |    7252 1509656644.47894: dumping result to json
2017-11-02 16:04:04,479 p=7211 u=joshv |    7252 1509656644.47929: done dumping result, returning
"><pre class="notranslate"><code class="notranslate">2017-11-02 16:03:24,692 p=7253 u=joshv |    7262 1509656604.69279: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py
  7262 1509656604.69401: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found_in_cache=True, class_only=False)
2017-11-02 16:03:24,694 p=7253 u=joshv |    7262 1509656604.69401: Loading ShellModule 'sh' from /usr/local/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found_in_cache=True, class_only=False)
  7262 1509656604.69887: assigned :doc
2017-11-02 16:03:24,699 p=7253 u=joshv |    7262 1509656604.69887: assigned :doc
  7262 1509656604.69952: Loaded config def from plugin (connection/network_cli)
2017-11-02 16:03:24,699 p=7253 u=joshv |    7262 1509656604.69952: Loaded config def from plugin (connection/network_cli)
2017-11-02 16:03:24,786 paramiko.transport starting thread (client mode): 0x742ed150L
2017-11-02 16:03:24,786 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.3.1
2017-11-02 16:03:24,787 paramiko.transport Remote version/idstring: SSH-2.0-Cisco-1.25
2017-11-02 16:03:24,787 paramiko.transport Connected (version 2.0, client Cisco-1.25)
2017-11-02 16:03:24,795 paramiko.transport kex algos:[u'diffie-hellman-group-exchange-sha1', u'diffie-hellman-group14-sha1', u'diffie-hellman-group1-sha1'] server key:[u'ssh-rsa'] client encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-cbc', u'3des-cbc', u'aes192-cbc', u'aes256-cbc'] server encrypt:[u'aes128-ctr', u'aes192-ctr', u'aes256-ctr', u'aes128-cbc', u'3des-cbc', u'aes192-cbc', u'aes256-cbc'] client mac:[u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none'] server compress:[u'none'] client lang:[u''] server lang:[u''] kex follows?False
2017-11-02 16:03:24,796 paramiko.transport Kex agreed: diffie-hellman-group-exchange-sha1
2017-11-02 16:03:24,796 paramiko.transport HostKey agreed: ssh-rsa
2017-11-02 16:03:24,796 paramiko.transport Cipher agreed: aes128-ctr
2017-11-02 16:03:24,796 paramiko.transport MAC agreed: hmac-sha1
2017-11-02 16:03:24,796 paramiko.transport Compression agreed: none
2017-11-02 16:03:24,807 paramiko.transport Got server p (2048 bits)
2017-11-02 16:03:25,075 paramiko.transport kex engine KexGex specified hash_algo &lt;built-in function openssl_sha1&gt;
2017-11-02 16:03:25,076 paramiko.transport Switch to new keys ...
2017-11-02 16:03:25,090 p=7253 u=joshv |  connecting to host SYCOMSW0002 returned an error
2017-11-02 16:03:25,090 p=7253 u=joshv |  (22, 'Invalid argument')
2017-11-02 16:03:25,177 paramiko.transport EOF in transport thread
2017-11-02 16:04:04,477 p=7211 u=joshv |    7252 1509656644.47682: handler run complete
2017-11-02 16:04:04,478 p=7211 u=joshv |    7252 1509656644.47803: attempt loop complete, returning result
2017-11-02 16:04:04,478 p=7211 u=joshv |    7252 1509656644.47853: _execute() done
2017-11-02 16:04:04,479 p=7211 u=joshv |    7252 1509656644.47894: dumping result to json
2017-11-02 16:04:04,479 p=7211 u=joshv |    7252 1509656644.47929: done dumping result, returning

</code></pre></div>