# Help with Basic IOS Command module

**URL:** <https://forum.ansible.com/t/help-with-basic-ios-command-module/24397>\
**Category:** Ansible Project\
**Created:** [May 4, 2017, 5:12am UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397 "2017-05-04T05:12:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bain](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@bain](https://forum.ansible.com/u/bain)\
**Post date:** [May 4, 2017, 5:12am UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/1 "2017-05-04T05:12:06Z")

</div>

If anyone is able to assist i would really appreciate it, I have spent hours looking around ,fixing random things and still cannot find why my script errors out on a 'type error"…

/etc/ansible/cisco$ cat tasks.yml

- hosts: all  
gather\_facts: no  
tasks:
- name: ios command  
ios\_command:  
commands:
- terminal length 0
- show interfaces

/etc/ansible/cisco$ cat hosts  
[ios]  
coreswitch ansible\_host=10.0.99.2 ansible\_ssh\_pass=password ansible\_user=ansible

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [May 5, 2017, 6:37pm UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/2 "2017-05-05T18:37:16Z")

</div>

Hi bain,

Looks like your missing connection: local in your playbook. See updated below:

- hosts: all  
gather\_facts: no  
tasks:
- name: ios command  
ios\_command:  
connection: local  
commands:
- terminal length 0
- show interfaces

---

<div class="post-metadata">

**Author:** ![Rodrigo](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@Rodrigo](https://forum.ansible.com/u/Rodrigo)\
**Post date:** [May 5, 2017, 10:06pm UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/3 "2017-05-05T22:06:25Z")

</div>

Hello All,

I am trying using ios\_command to get “show running”, however all the time task overwrite on the same file ( like txt ).

For example would like create file for each day? Which function I could use?

Kind Regards,  
Rodrigo

---

<div class="post-metadata">

**Author:** ![serrbondar](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@serrbondar](https://forum.ansible.com/u/serrbondar)\
**Post date:** [May 6, 2017, 12:19pm UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/4 "2017-05-06T12:19:21Z")

</div>

Hi Bain,

It seems the ios\_command module doesn’t work with Python3.5. Try running it with Python2.7.

Regards,Sergey

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [May 8, 2017, 12:13pm UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/5 "2017-05-08T12:13:29Z")

</div>

Hi Sergey, can you provide more details about what isn’t working in py3.5?

---

<div class="post-metadata">

**Author:** ![serrbondar](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@serrbondar](https://forum.ansible.com/u/serrbondar)\
**Post date:** [May 9, 2017, 12:32pm UTC](https://forum.ansible.com/t/help-with-basic-ios-command-module/24397/6 "2017-05-09T12:32:27Z")

</div>

Hi Peter,

persistent.py module raises the following exception:

```auto
File "/Users/sbondar/anaconda/envs/ansibleenv4/lib/python3.5/site-packages/ansible/plugins/connection/persistent.py", line 56, in _do_it
    cPickle.dump(self._play_context.serialize(), src)
TypeError: string argument expected, got 'bytes'

```

I’ve filed a bug report for this issue, more details there:

[https://github.com/ansible/ansible/issues/24355](https://github.com/ansible/ansible/issues/24355)

Cheers,  
Sergey
