# ios\_template, nxos\_template breaking order of src config

**URL:** <https://forum.ansible.com/t/ios-template-nxos-template-breaking-order-of-src-config/21696>\
**Category:** Ansible Project\
**Created:** [June 8, 2016, 8:11am UTC](https://forum.ansible.com/t/ios-template-nxos-template-breaking-order-of-src-config/21696 "2016-06-08T08:11:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Vavra](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@David\_Vavra](https://forum.ansible.com/u/David_Vavra)\
**Post date:** [June 8, 2016, 8:11am UTC](https://forum.ansible.com/t/ios-template-nxos-template-breaking-order-of-src-config/21696/1 "2016-06-08T08:11:42Z")

</div>

Hi, I would like to clarify how network template modules are handling given src configuration because so far I’ve found out several cases where its breaking the order of configuration commands.  
This is my u[sed playbook](https://gist.github.com/anonymous/1fbdf966aea5bf6ff9f85d3a59b0eab0).

For example:

tmplconfig.j2 :

vlan 901  
name 0901-vlan  
vlan 902  
name 0902-vlan  
vlan 903  
name 0903-vlan  
vlan 411  
name 0411-vlan  
vlan 427  
name 0427-vlan  
vlan 419  
name 0419-vlan  
vlan 870  
name 0870-vlan  
vlan 550  
name 0550-vlan  
vlan 554  
name 0554-vlan

for ios\_template and nxos\_template returns something like this:

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [switch-test] =\> {  
“template”: {  
“changed”: true,  
“updates”: [  
“vlan 411”,  
“vlan 413”,  
“vlan 415”,  
“name 0415-vlan”,  
“name 0552-vlan”,  
“name 0413-vlan”,  
“vlan 551”,  
“name 0551-vlan”,  
“vlan 552”,  
"vlan 870 ",  
“name 0870-vlan”,  
“name 0411-vlan”  
]  
}  
}

Single space intendation corrects this for IOS, doublespace for NXOS.

So, I have to use something like this:  
vlan 901  
name 0901-vlan

which is not optimal, because it looks like that it then does not match any existing configuration for the vlans (because of the two leading spaces before name vlan configuration subcommand).

---

<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:** [June 9, 2016, 3:19am UTC](https://forum.ansible.com/t/ios-template-nxos-template-breaking-order-of-src-config/21696/2 "2016-06-09T03:19:12Z")

</div>

ios\_template and nxos\_template work by reading in the input file, parsing it and comparing it against a parsed copy of the running config of the network device. In order for the template module to work effectively, the input file must match the same block syntax as the target device. Since ios and nxos use different configuration file syntax, you must supply two different input files (one for each OS).

In your example, you would need an input file for ios using single space block indents and a second input file for nxos using two space block indents.

Also, can you confirm what version of Ansible you are running. There as an issue with global ordering statements that was fixed before the final 2.1 was released.

---

<div class="post-metadata">

**Author:** ![David\_Vavra](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@David\_Vavra](https://forum.ansible.com/u/David_Vavra)\
**Post date:** [June 9, 2016, 7:17am UTC](https://forum.ansible.com/t/ios-template-nxos-template-breaking-order-of-src-config/21696/3 "2016-06-09T07:17:26Z")

</div>

Hi Peter, thank you for your quick answer.

I’m running ansible 2.2.0 with python 2.6.6 .

Dne čtvrtek 9. června 2016 5:19:19 UTC+2 Peter Sprygada napsal(a):
