# ENCOUNTERING MODULE FAILURE Error while using IOS\_template module

**URL:** <https://forum.ansible.com/t/encountering-module-failure-error-while-using-ios-template-module/23397>\
**Category:** Ansible Project\
**Created:** [January 6, 2017, 9:48am UTC](https://forum.ansible.com/t/encountering-module-failure-error-while-using-ios-template-module/23397 "2017-01-06T09:48:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgampawa](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sgampawa](https://forum.ansible.com/u/sgampawa)\
**Post date:** [January 6, 2017, 9:48am UTC](https://forum.ansible.com/t/encountering-module-failure-error-while-using-ios-template-module/23397/1 "2017-01-06T09:48:04Z")

</div>

Hello,

I am writing simple playbook to add configuration in Cisco 2800 router using jinja2 templates,Where I am able to generate Configuration file using Template module.But after generating the configuration file i.e. shubham.J2 i am getting the following error while pushing configurations to device.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: cnlabs(config)#  
fatal: [192.168.3.65]: FAILED! =\> {“changed”: false, “failed”: true, “module\_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible\_HV\_5qu/ansible\_module\_ios\_template.py", line 174, in \n main()\n File "/tmp/ansible\_HV\_5qu/ansible\_module\_ios\_template.py", line 165, in main\n response = module.config(commands)\n File "/tmp/ansible\_HV\_5qu/ansible\_modlib.zip/ansible/module\_utils/netcfg.py", line 54, in **call** \n File "/tmp/ansible\_HV\_5qu/ansible\_modlib.zip/ansible/module\_utils/ios.py", line 194, in configure\n File "/tmp/ansible\_HV\_5qu/ansible\_modlib.zip/ansible/module\_utils/shell.py", line 250, in execute\nansible.module\_utils.network.NetworkError: matched error in response: configure terminal\r\n ^\r\n% Invalid input detected at ‘^’ marker.\r\n\r\ncnlabs(config)#\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE”}

my configuration file looks like:(shubham.j2)

configure terminal  
interface fastEthernet 0/0  
ip address 1.1.1.1 255.255.255.0  
no shutdown  
exit

Using this configuration file I am trying to assign the above mentioned IP address to Fa 0/0 interface of my cisco device. And I am using ios\_template module in my playbook to push configurations in to Device.Can anyone help me to solve this error.

---

<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:** [January 6, 2017, 7:15pm UTC](https://forum.ansible.com/t/encountering-module-failure-error-while-using-ios-template-module/23397/2 "2017-01-06T19:15:24Z")

</div>

template files need to be structured as config files. shubham.j2 should look like this:

interface FastEthernet0/0  
ip address 1.1.1.1 255.255.255.0  
no shutdown

With indents… no need to add configure terminal as the module will handle that for you

---

<div class="post-metadata">

**Author:** ![sgampawa](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@sgampawa](https://forum.ansible.com/u/sgampawa)\
**Post date:** [January 8, 2017, 9:45am UTC](https://forum.ansible.com/t/encountering-module-failure-error-while-using-ios-template-module/23397/3 "2017-01-08T09:45:24Z")

</div>

Thank you so much Peter for helping me in this issue…As you mentioned in previous post i made the changes in my script and everything is working…Thanks
